[X-Unix] Altering .bashrc in bash to add to $PATH

William H. Magill magill at mcgillsociety.org
Thu Jan 8 13:08:10 PST 2004


On 08 Jan, 2004, at 10:11, Doug McNutt wrote:

> At 22:05 -0800 1/7/04, Robert Ameeti wrote:
>> echo $SHELL gives me /bin/bash
>> echo $PATH gives me /bin:/sbin:/usr/bin:/usr/sbin
>
> I'm a tcsh kind of guy but I have had similar problems.
>
> A solution is to create a directory $HOME/.MacOSX/ and place a file 
> there named environment.plist.
>
> The file gets formatted as XML and can define your full path for 
> everything in your login session to OS neXt. It is honored by pretty 
> much anything you do - BBEdit worksheets, AppleScript, Execute Text 
> service. Terminal though is likely to overwrite the PATH if if it's 
> allowed to source login files from /etc/.
>
> There is an Apple tech note on preparation of environment.plist.
>
> I have also found it helpful to add an echo or two to $HOME/.tcshrc 
> (er - .bashrc) with output directed to a log file. You can learn a lot 
> by seeing just how often and when it gets executed. Print out the 
> $SHLVL variable as well as $PATH

The important thing to understand here is that you are talking about 
apples and oranges.
They just look the same because they are both round:

   ...  The traditional Unix "dot files" (aka "Resource Control" or 
".rc" files)
         and "environment.plist."

If you are using the Aqua GUI (i.e. LoginWindow), the environment.plist 
is processed FIRST and all children of that process (like terminal) 
will inherit it's environment. If you then launch the terminal 
application, you invoke yet another initialization process (of which 
there can be several, depending upon Terminal's settings) and THEN 
invoke the shell setups.

However, if you are running batch jobs, or logging in via ssh, then 
ONLY the traditional Unix dot files are accessed.  (Which ones depend 
on which shell and how it is invoked, with is a longwinded discussion. 
... and X11 uses even different ones.)

The consequence is -- you MUST make changes to both the 
"environment.plist" and
your ~/.profile (or whichever) file. There are also implications to 
modifying the "system wide"
/etc/profile or /etc/*.login files which are different.

Second point -- "REAL Unix" applications running from the command line 
will normally utilize "dot" files. However, GUI based applications -- 
especially if they adhere to the OS X guidelines, will NOT access ANY 
".rc" files, but rather will read some XML file.

The entire issue and process of "initialization files" is like Perl -- 
There is more than one way to do the job.   ... one of the main reasons 
that SysAdmins get paid more than programmers.


T.T.F.N.
William H. Magill
# Beige G3 - Rev A motherboard - 768 Meg
# Flat-panel iMac (2.1) 800MHz - Super Drive - 768 Meg
# PWS433a [Alpha 21164 Rev 7.2 (EV56)- 64 Meg]- Tru64 5.1a
# XP1000 - [Alpha EV6]
magill at mcgillsociety.org
magill at acm.org
magill at mac.com



More information about the X-Unix mailing list