Reality check on bash behavior.
akonstam at trinity.edu
akonstam at trinity.edu
Thu Jan 12 21:55:32 UTC 2006
On Thu, Jan 12, 2006 at 05:55:08PM +0000, James Wilkinson wrote:
> akonstam at trinity.edu wrote:
> > I need to check that my observations on bash invocation is correct.
> > In the bash man page it states that when the bash shell in invoked the
> > following three files are sourced: /etc/profile, ~/.bash_profile and
> > ~/.profile. My observation is that when .bash_profile is present
> > .profile is not sourced.
> >
> > This is in important to us because we have the same user directories
> > mounted on FC4 machines and OS X machines, On OS X machines it looks
> > like .profile is sourced even when a .bash_profile exists.
> >
> > I just want to check that my sanity is still in place and I am seeing
> > what is really happening. I realize behavior on an OS X machine is off
> > topic on a fedora list.
>
> Good question!
>
> man bash says:
> --noprofile
> Do not read either the system-wide startup file /etc/profile or
> any of the personal initialization files ~/.bash_profile,
> ~/.bash_login, or ~/.profile. By default, bash reads these
> files when it is invoked as a login shell (see INVOCATION
> below).
> then
> 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.
>
> So your observations are consistent with documented behaviour on Fedora.
> I understand that this is so users who are stuck with an earlier Bourne
> shell can put bash in their .profile, create a .bash_profile, and things
> will still work.
I agree with your analysis of the man bash on Fedora. I just wanted to
see if I was reading it correctly.
>
> Unfortunately, I don't have access to an OS X machine.
>
> It's possible that something in Apple's default /etc/profile or
> ~/.bash_profile is sourcing ~/.profile anyway. But a quick Google
> suggests that this is not the case, and bash on OS X is not supposed to
> run ~/.profile anyway if ~/.bash_profile exists. See, for example, Geoff
> Lane's comments in
> http://www.macosxhints.com/article.php?story=20030825001724805
>
Now the comments to refer to above have marginal relevance for the
following reason. The latest OS X 10.4 uses bash as its default shell and
I assure you that .profile is sourced even when .bash_profile exists.
But this is not an OS X list so I will not push the point.
--
-------------------------------------------
Aaron Konstam
Computer Science
Trinity University
telephone: (210)-999-7484
More information about the fedora-list
mailing list