[Top][All Lists]

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

Re: PATH value doesn't get updated

From: Bob Proulx
Subject: Re: PATH value doesn't get updated
Date: Sun, 18 May 2008 15:45:08 -0600
User-agent: Mutt/1.5.13 (2006-08-11)

Peter Volkov wrote:
> Bob Proulx пишет:
> > The $0 is the name used to invoke the shell.  If it starts with a '-'
> > then this is used to instruct the shell that it is a login shell.  The
> > second variable $- is the flags set to the shell.  The 'i' for
> > interactive should be in there.
> Actually that's not exactly true. It's possible to start bash as login
> shell but - will be absent. Quoting relevant part of manual:
> "A _login_ shell is one whose first character of argument zero is `-',
> or one invoked with the `--login' option."

Yes.  To be pedantic about things I didn't say those were the only
ways and I did also mention --login in my mail.

> Better way to check if shell is login is:
>  $ shopt | grep login_shell
> login_shell     on

That will tell if bash *is* a login shell but that wasn't the question
that I was asking.  I was asking if bash was being instructed to be a
login shell using normal login conventions.  Seeing that $0 doesn't
start with a dash says that it wasn't.  Therefore bash is behaving

If you explicitly log into the host again such as with 'ssh localhost'
then you should see that sshd sets $0 to start with a dash.  Then bash
knows that it is a login shell.  Then bash sources the login
environment files.

It is just the unfortunate default configuration of GDM/KDM that
doesn't start up X sessions with some parent shell as a login shell
and therefore (by default) .bash_profile isn't getting sourced.  The
scripts don't cause personal environments to be sourced.  This is even
an FAQ for KDE.

Different GNU/Linux distros have taken steps to address this issue by
different methods and some have done nothing sticking to the default
behavior.  Debian and Ubuntu have not modified this and are using the
default behavior while Red Hat and SuSE have both taken *different*
actions to make login environments be sourced.  Plus there are several
classic Unix environments other than the new GNU/Linux ones that do
things the old ways.  Having many possibilities makes this a messy
problem to describe, document and address.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]