On Sunday 23 September 2007, Mrugesh Karnik wrote:

> From man bash:
>
> ``When  bash  is  invoked as an interactive login shell, or as a
> non-interactive 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 --noprofile option may
> be used when the shell is started to inhibit this behavior.
>
> <snip>
>
> 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.''

And this last is the part that fails to mention that a non-login shell 
will read /etc/bash/bashrc before ~/.bashrc, as the comments 
inside /etc/bash/bashrc and David Harel say.

Ok, after closer inspection, it seems that the /etc/bash/ way is a 
gentooism. Bash would normally define SYS_BASHRC and SYS_BASH_LOGOUT 
as /etc/bash.bashrc and /etc/bash.bash_logout respectively, even though 
it does not use them by default (they are commented in the sources). 
Nearly all linux distros uncomment those definitions, thus making bash 
use those files (see eg ubuntu). A gentoo patch, namely 
bash-3.0-configs.patch, changes those into /etc/bash/bashrc 
and /etc/bash/bash_logout. See bug #26952 (esp. from comment #52) and 
bug #90488 for further details. Note that gentoo applies the patch 
regardless of the vanilla USE flag.

So, it seems that, after all, the standard man page is correct, but, in 
gentoo, it probably should be patched to reflect the way things work in 
gentoo. Not sure whether this is enough to be worth a bug report?
-- 
[EMAIL PROTECTED] mailing list

Reply via email to