giving a nickname to an application?

pcoelho

Registered
Hello,

I use Terminal a lot. Very often I have to open a file in a specific Application, say:

> open -a textwrangler spectra.list

Many times, as in the example above, the Application name is sort of long... As I do it several times a day, I wonder if there is a way to set "nicknames" to applications, so that I could type only

> open -a tw spectra.list

and MacOSX will understand that by 'tw' I mean TextWrangler?

thx in advance
paula
 
In your Applications Folder
right-click on TextWrangler
select 'Make Alias'
type your chosen nickname
and you're done.
 
Yep, and you can go a step further and assign an "alias" to almost all of that command. If you're using bash, edit the .bashrc file and add a line that says:

Code:
alias tw='open -a textwrangler'

Then, in order to open a file from the Terminal as in your example, you could simply type:

Code:
tw spectra.list

...and the actual "code" that gets executed in the Terminal is:

Code:
open -a textwrangler spectra.list

Once you edit the .bashrc file, you must either start a new Terminal instance, or type "source .bashrc" while in the current working directory where .bashrc is located for the changes to take effect.

Here's a short rundown on how bash aliases work:

http://www.hypexr.org/bash_tutorial.php#alias

Now, if you wanted to simply alias the string "textwrangler" to "tw", then you may want to look into bash variables, such that you could do things like:

Code:
open -a $TW somefile.txt
which $TW
stat $TW

...and so on and so forth.
 
Back
Top