Monday, August 11, 2008

the difference between .bashrc and .bash_profile

When you "man bash", debian will show you the difference between bashrc and bash_profile. But one word make me confuse, what's the login? Login the xwindows or terminal ?


When I log in the xWindow , I change the environment "PATH" IN .bash_profile, but it doesn't work. If I change the "PATH" in .bashrc, it works..It's suprising .


After google,,I find that the "log in" is login the termainal ,not the xwindow. So the .bash_profile does not work when you login the xwindow.


In fact .bashrc can work whatever you login termainal or xwindow.
The reason is you will find follow command in .bash_profile:

# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi


So if you want create or add the environment variable ,it should be better to change .bashrc.

For example:

export PATH=$PATH:/home/username/lib:/usr/lib

No comments: