[X-Unix] setting up aliases in bash / Tiger

Doug McNutt douglist at macnauchtan.com
Wed Sep 27 14:29:23 PDT 2006


At 18:52 +0100 9/27/06, Stroller wrote:
>On 27 Sep 2006, at 18:40, ..lj wrote:
>>On Sep 27, 2006, at 10:18, David Gilden wrote:
>>>
>>>Could someone point to me tutorial that would show me what files  in Tiger
>>>I can edit in Terminal so that I can set up some basic aliases...?
>>
>>try editing
>>~/.profile
>
>I can't remember exactly why one set of aliases is one & not the  other. Most of the time both shells are sourced, but I believe there  are some commands that you might not wish to be aliased in a non- interactive shell (such as a cron job?).

Be very wary of the way OS neXt handles the login concept.  Logging in to the aqua interface from the startup GUI has nothing to do with a real UNIX login that runs your login scripts.

If you execute a "do shell script" from AppleScript or attempt to execute some selected text with a service you  will not be "logged in" to UNIX. You won't even get your specified login shell. That's even true for some aspects of cron jobs. Your $PATH variable may not be what you want.

If it's environment variables you want set at login to aqua it can be done in an XML file $HOME/.MacOSX/environment.plist which you have to create. If it's shell aliases you can't do it there.

One way is to be sure your entry is via a full path to a text file with the execute permissions set and a #!/bin/tcsh, or the like, in the first line. That will execute $HOME/.tcshrc for me or probably $HOME/.bashrc for you. It will not execute scripts that are defined as "execute at login". Those may and may not be executed when you create a Terminal.app window but are probably used if you login from another machine using ssh or telnet. If anyone knows, with authority, what Terminal.app does when starting, opening a new window, and opening a *.command file I'd like to hear it. BBEdit worksheets run the *rc files only and each worksheet has its own environment.

You can do some testing by modifying the run and startup scripts that you think you're using so that they write to a special log file $HOME/seeithappen.txt that you create. You may find strange things such as /etc/cshrc overwriting your $PATH variable without notice.

date >> $HOME/seeithappen.txt
echo $SHLVL  >> $HOME/seeithappen.txt
echo $PATH  >> $HOME/seeithappen.txt

are instructive.
-- 

Applescript syntax is like English spelling:
Roughly, though not thoroughly, thought through.


More information about the X-Unix mailing list