.bashrc versus .bash_profile

buc99

Don't Tread on Me!
From what I gather from the bash man file, .bash_profile is for and interactive login shell and .bashrc is for a non-login interactive shell. I adjusted .bashrc to add to my path and add an alias and opened a new Terminal window and nothing happened. So I put the changes into .bash_profile instead and opened a new Terminal window and the changes took effect. I then started Apples X11 app which opens an xterm. The changes from the .bash_profile file did not take affect. I had to put the same changes in the .bashrc file for them to work in the xterm. So now both my .bash_profile and .bashrc files are exactly the same. This does not make any sense to me. Can someone please explain the differences to me and why Terminal and xterm work differently in this fashion?

Thanks.
SA :D
 
Good question.

I really don't understand the difference either.
I have my aliases and commands to turn on color in the terminal in .bashrc. The only problem was that my aliases didn't work. I had to put "source $HOME/.bashrc" into my .bash_profile. It seems that at startup, .bash_profile is read, and then that file points to .bashrc. You should be able to do the same (put source $HOME/.bashrc into .bash_profile) and put only the commands into .bashrc.

The only reason I did this was because I found a link somewhere that said to do this and it worked.
 
vikingshelmut said:
I had to put "source $HOME/.bashrc" into my .bash_profile.

This is what I had to do also, the thing is that I do not understand is why xterm reads one file and Terminal reads the other on startup. I would have thought that they would both read the same file on startup.

Thanks.
SA :D
 
Back
Top