Execution Sequence of .bash_* files

From linux.dipin.info

Execution sequence for interactive login shell
execute /etc/profile
IF ~/.bash_profile exists THEN
execute ~/.bash_profile
ELSE
IF ~/.bash_login exist THEN
execute ~/.bash_login
ELSE
IF ~/.profile exist THEN
execute ~/.profile
END IF
END IF
END IF

When you logout of the interactive shell, following is the sequence of
execution:
IF ~/.bash_logout exists THEN
execute ~/.bash_logout
END IF

Please note that /etc/bashrc is executed by ~/.bashrc as shown below:
# cat ~/.bashrc
if [ -f /etc/bashrc ]; then
. /etc/bashrc
Fi

Execution sequence for interactive non-login shell
While launching a non-login interactive shell, following is the sequence of
execution:
IF ~/.bashrc exists THEN
execute ~/.bashrc
END IF

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.