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

Re: [debian-knoppix] Re: Does Bash follow man bash INVOCATION conventions?



Klaus Knopper wrote:
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

Klaus. Thanks for your kind and informative reply. I'm happy you know of the problem.

You may also be interested to know that when I su in an xterm (Konsole) /etc/profile alone runs. This must be a log-in shell since usually you have to log in after an su. Thus running /etc/profile would be correct.

Since /etc/profile always runs last I'll just make sure everything needed is there. My custom path adds my scripts in /etc/bin and sources my bashrc with systemwide aliases and functions - both will be added to /etc/profile

Thanks for your explanation and help.

Larry


--
Larry Alkoff N2LA - Austin TX
Using Thunderbird on Slackware Linux


Reply to: