[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Does Bash follow man bash INVOCATION conventions?



On Tue, Jun 14, 2005 at 10:23:21PM -0500, Larry Alkoff wrote:
> Using Knoppix 3.8 and setting up my customizations for saveconfig.
> 
> I put echo statements in /home/knoppix.bashrc and /etc/profile to see 
> how they run.  Knoppix is otherwise virgin.
> 
> When I click on an xterm I get the following display:
> executing /etc/profile
> executing ~/.bashrc
> executing /etc/profile
> 
> Why is bash executing /etc/profile when I click on Konsole in KDE which 
> is a "non-login" shell?
> 
> I see that ~/.bashrc sources /etc/profile which explains why it runs 
> after .bashrc but why does it run the first time?
> 
> According to man bash INVOCATION section:
> 
> An interactive logon session reads/executes /etc/profile if it exists,
> then reads/executes the first found of ~/.bash_profile, ~/.bash_login or 
> ~/.profile.  None of the last three are found in Knoppix 3.8 so only 
> /etc/profile should be executed.
> 
> A non-login shell reads and executes /etc/bashrc.bashrc if found _and_ 
> reads and executes ~/.bashrc.  Since only .bashrc exists in Knoppix 3.8 
> only ~/.bashrc can run.

I noticed that behaviour, too, which differs from the manpage. Because
of that, I had added . /etc/profile to .bashrc in the first place.

Since bash is unchanged from the debian default in Knoppix, I can only
suspect that either the manpage is wrong, or the bash package maintainer
(dpkg -s bash) has changed bash's behaviour with a (probably, haven't
looked thoroughly) undocumented patch.

With kind regards
-Klaus Knopper


Reply to: