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

Re: Setting $PATH



On Tue, Aug 14, 2001 at 08:35:46PM +0200, Jesper Holmberg wrote:
| I might have misunderstood something here, but my bash{profile,rc} files
| don't work as I expect.
| 
| In my .bash_profile, I have this:
| 
| PATH="~/bin:${PATH}"
| export PATH
| 
| This works as expected after I have logged in, I do have ~/bin in my
| path. However, when I start X, my ~/bin is gone from the path. I thought
| it'd stay there as long as I'm logged in. So, if this isn't the case,
| where should I best put this so that it stays for the whole time?

Do you mean when you start a terminal in X you don't have ~/bin in
your path?

All settings (such as $PATH) persist through the life of the shell.
If you start another shell you start from the beginning again (after
reading the proper config files).

IIRC .bash_profile is executed on login only.  When you start an xterm
you aren't logging in so it isn't executed.  The .bashrc is run
whenever bash is started.  I put all the config I wanted in my .bashrc
and my .bash_profile has the following at the top :

    if [ -f ~/.bashrc ] ; then
        source ~/.bashrc
    fi

so I get the same effect when I login as when I start a shell any
other way.

HTH,
-D



Reply to: