-
.bashrc vs .bash_profile vs .profile
Despite years of various Unix flavor development, I can never remember the difference between the above mentioned files. So, I thought I’d finally document the outcome of my experiment here for posterity:
bash_profile: interactive login shells
bashrc: non-interactive login shells
profile: I’m guessing this is used when you do not have a bash_profile file. I found it hard to find a definitive answer, though.
$ cat .bashrc
export BASHRC=’loaded’
$ cat .bash_profile
export BASH_PROFILE=’loaded’
$ cat .profile
export PROFILE=’loaded’
$ echo $BASHRC$ echo $BASH_PROFILE
loaded
$ echo $PROFILERemoving my .bash_profile file gives the following results:
$ echo $BASHRC
$ echo $BASH_PROFILE
$ echo $PROFILE
loadedSo, it looks like the .profile is loaded when no .bash_profile exists, but that the .bash_profile supercedes .profile when it is found, preventing it from being loaded.
At least in Snow Leopard :)
Posted on November 6, 2009