which .profile is used

Chris Kassopulo ckasso
Mon May 17 11:39:18 PDT 2004


On Wed, 23 Oct 2002 15:58:10 -0500
"David A. Bandel" <david at pananix.com> wrote:

> > 
> > Qualifiers added.
> > 
> > files that don't exist are ignored
> > 
> > login shell (SHLVL=1):
> >   /etc/profile and
> >   $HOME/.profile or
> >   $HOME/.bash_profile or
> >   $HOME/.bash_login
> >  
> > non-login shell (SHLVL>=2):
> >   /etc/bashrc and
> >   $HOME/.bashrc
> > 
> > logout:
> >   /etc/logout and
> >   $HOME/.logout or
> >   $HOME/.bash_logout
> >  
> > Chris Kassopulo
> 
> Excellent, Chris.  Jeesh, I 'd forgotten this (wrote it six months ago
> -- no research, just three minutes typing out what was in my head). 
> I'd forgotten .bash_login, since I haven't used .xx_login since my
> Ultrix days.  You sure the login shell doesn't check both .profile and
> .bash_profile if they're both there?
> 
> Other than that, the above qualifiers look good.
> 

Just one of .profile or .bash_profile is run but order matters.
I rearranged below to reflect the order.  I'm not really sure
about the logout stuff.  I only see reference to .bash_logout
in man bash.

files that don't exist are ignored

login shell (SHLVL=1):
  /etc/profile and
  $HOME/.bash_profile or
  $HOME/.bash_login or
  $HOME/.profile
 
non-login shell (SHLVL>=2):
  $HOME/.bashrc and
  /etc/bashrc
  
logout:
  /etc/logout and (not sure here)
  $HOME/.logout or (not sure here either)
  $HOME/.bash_logout
 
Chris Kassopulo


More information about the Linux-users mailing list