What does osascript stand for? - darwin

I am trying this command
osascript <<EOD
tell "Finder" something
etc
etc
In this command, what does the acronym osascript stand for?

Related

Ubuntu terminal: I can't seem to launch programs from my terminal anymore. I use sublime, rails and heroku

I don't know when exactly this problem started or what caused it, but any command that implies calling a program or anything external to my terminal doesn't work. Here are a few examples:
stt
heroku open
rails s
These are the ones I use but it seems to be a pattern with opening something external. These commands appear green when I type them. stt is supposed to open sublime but doesn't anymore.
heroku open, doesn't open my app in the browser, and rails s connects to the local server but I have to open my app manually.
Any ideas ?
Thanks!
OK, I found the answer. Something was conflicting in my zshrc file (in the dotfiles), I probably had installed something, not sure what. I removed the following lines manually in the zsh file and everything is working again:
# Encoding stuff for the terminal
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export BUNDLER_EDITOR="subl $# >/dev/null 2>&1 -a"
export BUNDLER_EDITOR="subl $# >/dev/null 2>&1 -a"
export BUNDLER_EDITOR="subl $# >/dev/null 2>&1 -a"
export DISPLAY=127.0.0.53:0
export DISPLAY=127.0.0.53:0
export BUNDLER_EDITOR="subl $# >/dev/null 2>&1 -a"

Completely confused with my $PATH, iTerm, and ZSH setup

So I'm trying to add TeX Live to my PATH and I couldn't be more confused.
(For the record, I'm using iTerm and oh-my-zsh on Mac OS X)
In my .zshrc file, my path looks like this:
# Path to MAMP PHP
export PATH=/Applications/MAMP/bin/php/php5.5.10/bin
# Path to LaTeX
export PATH=/usr/local/texlive/2014basic/bin/x86_64-darwin:$PATH
After adding the last two lines, my iTerm starts with errors looking like:
/Users/zach/.zshrc:17: command not found: killall
/usr/bin/env: zsh: No such file or directory
box_name:1: command not found: hostname
and more...
My /etc/paths file looks like
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/usr/local/texlive/2014basic/bin/x86_64-darwin
However, after ALL of this, echo $PATH just returns:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Please help me...I am getting so frustrated. All I want to be able to do is run tlmgr.
You did not included full .zshrc so hard to figured out what is going on, but I guess that in first line you rather want
PATH=$PATH:/Applications/MAMP/bin/php/php5.5.10/bin
Otherwise you wouldn't be able to call any commands directly from e.g. /usr/bin, and messages like "command not found" only confirm my suspicion.

ios uialertview through mobile terminal command

Is there a terminal utility for ios or a script that can be written so that with a command into mobile terminal or through ssh, a uialertview will pop up?
For example, into terminal, i type in >alert [message] [title] [buttonmessage]
and an alert on the screen pops up with the specified parameters.
Use osascript, for example:
osascript -e 'tell app "Finder" to display dialog "Hello World"'
osascript -e 'tell app "System Events" to display dialog "Hello World"'

Using the Command-line Command to launch Sublime Text 2 on OS X

I just started reading Michael Hartl's book on Rails and I've run across a problem in the setup phase. Hartl keeps referring to making a file in my home directory, but I'm not quite sure how to do this. For example, when I try to setup the command line for sublime text the instructions tell me to do this: Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
My problem is that I don't know how to put a ~/bin directory in my path. I know this is real basic but any help would be greatly appreciation.
create or edit ~/.profile (works with both bash and zsh)
add the following
export PATH=$PATH:$HOME/bin
The line above is saying, overwrite the PATH environment variable and set it to the previous path plus ~/bin
Now when you try to run a command, bash will look in all the colon separated paths in your PATH environment variable for an executable.
To see your entire PATH, type echo $PATH in a terminal. Or better yet, type env to see all environment variables.
On your terminal
$ mkdir ~/bin
$ sudo ln -s "/Applications/Sublime Text2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
Edit ~/.base_profile
export PATH=$PATH:~/bin
usage:
open current directory:
subl .
In your ~/.bashrc file add to the end:
PATH="$HOME/bin:$PATH"

find a command on $PATH

I'm writing a script, and I need to look up a command on the user's $PATH and get the full path to the command. The problem is that I don't know what the user's login shell is, or what strange stuff might be in their do files. I'm using the bourne shell for my simple little script because it needs to run on some older Solaris platforms that might not have bash.
Some implementations of "which" and "whence" will source the user's dot files, and that isn't really portable to all users. I'd love a simple UNIX utility that would just do the basic job of scanning PATH for an executable and reporting the full path of the first match.
But I'll settle for any /bin/sh solution that is stable for all users.
I'm looking for a solution that is better than writing my own /bin/sh loop that chops up $PATH and searches it one line at a time. It would seem that this is common enough that there should be an reusable way to do it.
My first approximation of the "long way" is this:
IFS=:
for i in $PATH; do
if [ -x $i/$cmd ]; then
echo $i/$cmd
fi
done
Is there something simpler and portable?
The answer seems to be the 'type' built-in.
% /bin/sh
$ type ls
ls is /bin/ls
Maybe the whereis command will work for you?
whereis -b -B `echo $PATH | sed 's/:/ /g'` -f [commands]
e.g. on my computer, this works:
whereis -b -B `echo $PATH | sed 's/:/ /g'` -f find man fsc
And results in:
find: /usr/bin/find
man: /usr/bin/man
fsc: /opt/FSharp-2.0.0.0/bin/fsc.exe /opt/FSharp-2.0.0.0/bin/fsc
One caveat from the whereis man page:
Since whereis uses chdir(2V) to run faster, pathnames given
with the -M, -S, or -B must be full; that is, they must begin
with a `/'.
This question is answered in details here: https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then. Bottom line: use command -v ls.

Resources