~/bin not added to path

ZIYAD A. M. AL-BATLY zamb at spymac.com
Thu Apr 14 17:45:32 UTC 2005


On Thu, 2005-04-14 at 13:50 +0200, Christoph Sturm wrote:
> hey guys!
> 
> I am probably missing something obvious here, but i am expiriencing a
> strange effect:
> I have created a bin directory in my home directory, and had the
> expectation that this snippet from .bash_profile would add it to the
> path:
> if [ -d ~/bin ] ; then
>     PATH=~/bin:"${PATH}"
> fi
> 
> but after logging into gnome its not added.
> when i do "su - chris", it works. 
> 
> Is that "by design" or a bug?
> 
> thanks
>  chris
> -- 
> christoph.sturm at gmail.com
> 
It's by design (not a bug).  It has been discussed before. Check the
mail archive for more info (about two weeks ago). Also, check the manual
page of "bash".

In short, ~/.bash_profile is read and executed only in a "login-shell"
not normal shell.  When you start gnome-terminal (or any other terminal
emulator) it start a normal shell (this is by default, but it can be
changed) but when you type "su - username" (or logging in from the
console) you're starting a login-shell. If you want to add ~/bin to your
"$PATH" and be effective in GNOME, put the line:
        [ -r ~/.bash_profile ] && . ~/.bash_profile
in ~/.gnomerc and restart GNOME and you should be set.

Ziyad.





More information about the ubuntu-users mailing list