PATH variable

Robert Locke rlocke at ralii.com
Wed Sep 8 13:59:16 UTC 2004


On Wed, 2004-09-08 at 02:02, Joachim Backes wrote:
> Hi,
> 
> can somebody tell me where the PATH variable is initially set? I'm sure, not
> in /etc/profile.
> 
> Regards
> 
> Joachim Backes
> 

>From man bash:


>        When  bash is invoked as an interactive login shell, or as a non-inter-
>        active shell with the --login option, it first reads and executes  com-
>        mands  from  the file /etc/profile, if that file exists.  After reading
>        that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
>        in  that order, and reads and executes commands from the first one that
>        exists and is readable.  The --noprofile option may be  used  when  the
>        shell is started to inhibit this behavior.
>                                                                                 
>        When  a  login  shell  exits, bash reads and executes commands from the
>        file ~/.bash_logout, if it exists.
>                                                                                 
>        When an interactive shell that is not a login shell  is  started,  bash
>        reads  and executes commands from ~/.bashrc, if that file exists.  This
>        may be inhibited by using the --norc option.  The --rcfile file  option
>        will  force  bash  to  read  and  execute commands from file instead of
>        ~/.bashrc.
>                                                                                 

Then, in reading the default /etc/profile:


> for i in /etc/profile.d/*.sh ; do
>     if [ -r "$i" ]; then
>         . $i
>     fi
> done
>  

So the moral of the story is:

For login shell:
	1) /etc/profile
		which will call /etc/profile.d/*.sh
	2) ~/.bash_profile or ~/.bash_login or ~/.profile

The PATH is a variable that is set/modified by any of these.... 
Remember that he who saves last wins....

HTH,

--Rob






More information about the fedora-list mailing list