Solved: Problem with bash login.

Ben Scott dragonhawk at gmail.com
Tue Aug 1 15:32:01 EDT 2006


On 8/1/06, Paul Lussier <p.lussier at comcast.net> wrote:
> So, what do you put in your .xsession file?  Everything that's in
> .bash[rc,_profile]? or do you just source the correct file from there?
>
> If the latter, which is the correct one again?

  It is more useful to explain the semantics of bash initialization
files then it is to call one "correct".  IIRC:

~/.bash_profile is run at bash init for login shells.

~/.bashrc is run at bash init for non-login interactive shells.

The file pointed to by BASH_ENV (if any) is run at bash init for
non-interactive shells.

  I believe Mr. Orr's major point is that, if you set environment
variables in ~/.bashrc, they will clobber any changes set later, if
you invoke a subshell.

  For example, say you set your regular PATH in ~/.bashrc, and source
~/.bashrc from ~/.bash_profile.  Next, support you are at a shell
prompt, and you change the PATH to put a directory with alternative
versions of some programs first.  Then you do something which leads to
a subshell.  Since ~/.bashrc runs when the subshell starts, the custom
PATH will be clobbered.  That will probably not be what you want.

-- Ben



More information about the gnhlug-discuss mailing list