Search Path in Bash

Peter Risdon peter at circlesquared.com
Mon Mar 1 00:24:19 PST 2004


Gerard Seibert wrote:

>Peter Risdon writes:
>  
>
>>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.
>>
>>
>>    
>>
>
>********** Reply Separator **********
>Sunday, February 29, 2004 6:01:48 PM
>
>Peter, you stated the following:
>
>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  commands 
>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 credit has been lost along the way, but I was quoting the man page.

>If I am following you correctly, then having a ~/,bashrc, ~/.bashrc or
>~/.profile file is worthless, if bash reads only the first file that it
>finds. I am referring in this scenario to the ~/.bash_profile file.
>  
>
I haven't ever tried multiple ~/.bashconfigfiles. FWIW, the idea that 
more than one might get read seems a little scary. If it was, trying to 
debug unexpected bash behaviour would certainly lead to a head-shaped 
crater in the wall by my desk.

>That isn't exactly what I gleamed from the "FreeBSD" book by Annelise
>Anderson. Perhaps what she is referring to is an older version of bash.
>  
>
I'm sorry, but I haven't read this.

>I am not insinuating that you are incorrect; I am just trying to get
>the most accurate information in regards to how bash works.
>  
>
Absolutely.

PWR.




More information about the freebsd-questions mailing list