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

Re: How to add dir to path



This is to the list this time, instead of a direct reply  -- Sorry!

"Manon Metten" <manon.metten@gmail.com> writes:

> 1.  (*) text/plain          ( ) text/html           
> 
> Hi Andrei,
> 
> On 8/10/07, Andrei Popescu <andreimpopescu@gmail.com> wrote:
> 
> Just look at your .bash_profile:
> >
> > # ~/.bash_profile: executed by bash(1) for login shells.
> 
> 
> 
> And in .bashrc I find:
> 
>  # ~/.bashrc: executed by bash(1) for non-login shells.
> 
> 
> So this is my conclusion:
> Whenever I open a new bash window, .bash_profile is executed,
> coz bash is invoked as: /bin/bash --login.
> 
> On the other hand, when I open a new session, obviously there's
> no need to invoke it as /bin/bash --login and thus .bashrc is executed.
> 
> 
> I found a very useful link to learn more about shells:
> http://learnlinux.tsf.org.za/courses/build/shell-scripting/ch02.html
> 
> 
> Thanks for your response, Manon.

Sorry for getting into this so late, but I just realized that I used a
completely different solution.  The .xsession file is used to
initialize the [gxk]dm session, so any environment variables can go
in there.  In my case I had enough variables I didn't want to duplicate
.bash_profile and .xsession, so I put all of them in another file I
called .bash_env.  Then in both .bash_profile and .xsession I put
the following code:

    if [ -r ~/.bash_env ]
    then
        . ~/.bash_env       # read in all environment variables
    fi

That way I can get the same environment from both a regular login or
xterm window.

Hope that helps.

-- 
Carl Johnson		carlj@peak.org



Reply to: