关于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 了.
本文详细介绍了Bash shell的不同类型(交互式与登录式),并解释了Bash如何加载配置文件,包括/etc/profile、~/.bash_profile等。还提供了一个简单的测试方法来判断当前Shell是否为交互式的。

被折叠的 条评论
为什么被折叠?



