views:

615

answers:

2

it seems that we will put

source ~/.bashrc

in our .bash_profile anyway. So why not just use one file, say .bashrc ?

+7  A: 

Because there may be things you only want to do once per login (so in .bash_profile) rather than every time an xterm or the like opens (as per .bashrc), for example asking the user for a passphrase to decrypt and load SSH keys into an ssh agent, etc etc.

Alex Martelli
+4  A: 

You can put some things in .bash_profile that are not appropriate for a shell instance that is not a terminal. For example, if you ran an external command from your editor through the shell - the shell instance would source .bashrc but not .bash_profile. For example, I might put alias ls=ls -F in my profile, but you wouldn't want that alias applied for just any instance of the shell, just ones you would interact with.

1800 INFORMATION
Just want to note that the RC file is read on interactive shells only (unless forced or different startup mode, like POSIX mode or sh).
TheBonsai