Set Environment Variable

ZIYAD A. M. AL-BATLY zamb at saudi.net.sa
Sun Jul 10 22:23:48 UTC 2005


On Sun, 2005-07-10 at 16:01 -0400, Sean Sieger wrote:
> I have added
> 
> PATH=$PATH:~/bin
> 
> to .bashrc; when I add ~/bin to my path in 'profile', do I not need it in
> .bashrc any longer? Well, that will be what I be looking into. Thank you
> for the answer -- it appears, for my needs, to be the correct answer.
> 
> Thank you, Robbo.
> --
> Sean
> 
This subject has been discussed a lot latelay in this list (I'm not
bashing you for asking as it's your right to do so).

There are two types of shells: "login" and, will, "non-login" shells.

In login shells, it always reads "/etc/profile" then "~/.bash_profile",
"~/.bash_login", and "~/.profile" (in that order as long as they exist
and *stops* after the first one found and readable).

In non-login shells, it reads "/etc/bash.bashrc" and "~/.bashrc".

"login" shells are the one that start with the argument "--login" passed
to them.  "initd" do that for the console shells.  In "gnome-terminal"
you need to check some option to make the shell a "login" one.
"non-login" shell are the normal shell you start by running
"gnome-terminal" or "xterm" (assuming you didn't change the default
options).

Also, in most cases you need to "export" the variable for it to take
effect.  e.g.:
        PATH="$PATH:~/bin"
        export PATH

I hope this clears thing for you.
Ziyad.




More information about the ubuntu-users mailing list