Re: PATH value doesn't get updated

2008-05-12 Thread Carl Wenrich
I just log into the box that appears on the standard ubuntu startup. I enter my 
username and password, then the desktop comes up.

I see now that the .bash_profile isn't being sourced (I thought it was 
according to what I've been able to pick up on the web). If I source it 
manually, the $PATH gets updated.

Why does ubuntu provide the .bash_profile when a user is created, and then not 
source it when the system starts up? And since it doesn't, what do I change to 
make it happen?

Bob Proulx <[EMAIL PROTECTED]> wrote: Carl Wenrich wrote:
> echo $0 gives me "bash"
> echo $- gives me "himBH"

Then bash hasn't been invoked as a login shell and therefore isn't
instructed to source the .bash_profile.

> If it is not a login shell then to suggest improvements it would be
> necessary to know the type of system you are using and how you are
> logging into it.  There are many possibilities and I can't guess which
> one you might be using.  You didn't say in your messages.

You have yet to say how are you are logging into your machine.  There
are many possibilities and without information it is impossible to
guess.

In the hope that it is helpful I will take a shot in the dark...

On my HP-UX machine I log into the text console.  This gives me a
login shell that sources my .bash_profile.  I then start X11 using
'xinit' which inherits all of the exported variables.  On my Debian
GNU/Linux machine I log in using GDM.  Because logging in with XDM, or
GDM, or KDM doesn't start a login shell I need to tell it this
explicitly.  I use an executable ~/.xsession file.  In it I explicitly
tell bash that it is a login shell which causes my .bash_profile to be
sourced.  Subsequent shells inherit the environment.  This is what I
use in my personal configuration:

  #!/bin/bash --login
  # exec x-session-manager
  # exec gnome-session
  # exec startkde
  exec fvwm2

Red Hat solves this problem in a better way by invoking the user
session as a login shell from the system X start up scripts.  By doing
it that way the user doesn't need to worry about it.  Last time I
checked SuSE was a problem because it forced sourcing of the
$HOME/.bash_profile (or was it .profile?)  regardless of the user
shell and then redirected all errors to /dev/null effectively ignoring
them.  Other systems will be similarly different.

In any case I believe you have an answer to your question about why
your ~/.bash_profile wasn't being sourced.  It wasn't being sourced
because your shell isn't invoked as a login shell and therefore
shouldn't source it.

Good luck!

Bob



Re: PATH value doesn't get updated

2008-05-12 Thread Carl Wenrich
echo $0 gives me "bash"
echo $- gives me "himBH"

Bob Proulx <[EMAIL PROTECTED]> wrote: Carl Wenrich wrote:
> Bob Proulx wrote:
> > Did you log in after having made that change?  Was bash invoked as
> > an interactive login shell so that it would read that file?
> > 
> >   echo $0
> >   echo $-
>
> Yes. I (1) made the change to .bash_profile, then (2) restarted the
> machine, then (3) logged in again. When I echo $PATH the
> /opt/lampp/bin is not included.

That second question was also very important.  Without that
information I don't know if I should suggest one action or a different
action.

  Was bash invoked as an interactive login shell so that it would read
  that file?

The way I tell is by running those two commands that I suggested
running.  What do you get for the following two commands?

  echo $0
  echo $-

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.

Example: NOT a login shell, will NOT source .bash_profile:

  $ echo $0
  bash
  $ echo $-
  himBHP
  $

Example: Yes, a login shell:

  $ echo $0
  -bash
  $ echo $-
  himBHP
  $

And of course the bash "-l" and "--login" options will override this
default behavior.

If it is not a login shell then to suggest improvements it would be
necessary to know the type of system you are using and how you are
logging into it.  There are many possibilities and I can't guess which
one you might be using.  You didn't say in your messages.

By the way... It is not necessary to restart your system.  That is way
too much.  Simply log in again to have profile file changes take
effect.

Bob



Re: PATH value doesn't get updated

2008-05-12 Thread Carl Wenrich
Yes. I (1) made the change to .bash_profile, then (2) restarted the machine, 
then (3) logged in again. When I echo $PATH the /opt/lampp/bin is not included.

Bob Proulx <[EMAIL PROTECTED]> wrote: carlwenrich wrote:
> I put this in my .bash_profile:
> 
> PATH=$PATH:/opt/lampp/bin
> export PATH
> 
> but when I "echo $PATH" it doesn't include the /opt/lampp/bin.

The .bash_profile is sourced by bash when it is invoked as an
interactive login shell.  Therefore you would need to log in after
having made that change in order for bash to read the file and the
effect to be seen.  Did you log in after having made that change?  Was
bash invoked as an interactive login shell so that it would read that
file?

  echo $0
  echo $-

Bob