关于bash:
Bash Reference Manual : http://www.gnu.org/software/bash/manual/bashref.html
startup files: http://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files
如果是login的shell,那么bash在运行先执行 /etc/profile ;然后依次查找 ~/.bash_profile, ~/.bash_login, ~/.profile;如果找到其中一个文件就执行之,后面的就不执行了.
如果是interactive的非login shell,则先会执行 /etc/bash.bashrc,如果~/.bashrc存在的话,接着执行~/.bashrc.
如果是非interactive的,且非login shell,则执行 $BASH_ENV 对应的shell.
什么是interactive shell,什么是login shell
interactive shell就是顾名思义,有用户交互的,检查方法就是在命令行下执行 echo $-,如果有i这个选项,则就是interactive shell 了.