Question

it seems that we will put

source ~/.bashrc

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

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top