更改启动shell
chsh -s /bin/bash
shell目录文件
/etc/shells
区别.bash_profile与.bashrc
区别:.bash_profile当shell是login shell时会加载;.bashrc当shell时non login shell时会加载
Mac OS X:运行时并没有运营一个shell,因此打开Terminal时,shell时login shell
Linux图形界面:打开Terminal时,shell时non login shell
Login shell
命令行:依次运行~/.bash_profile、~/.bash_login、~/.profile,但只要有一个读入,后面就停止了
图形化:只加载/etc/profile和~/.profile
Non login shell
读入用户自己的bash配置文件~/.bashrc,其他都不读。
Mac shell
Mac的Terminal打开的每个新shell默认为login shell只加载.bash_profile。而且,不管是ssh登录,还是在图形界面里启动shell窗口,都是如此。
捎带启动.bashrc
if [ -f ~/.bashrc ]; then
. ~/.bashrc #相当于source ~/.bashrc
fi