shell状态

login shell & no-login shell

  • login shell
    • 当你通过终端输入用户名和密码,然后进入到terminal,这时候进入的shell环境就叫做是login shell,例如,通过ssh远程进入到主机。
    • login shell 运行的脚本文件 .bash_profile
  • no-login shell
    • 例如你已经登陆了你的桌面电脑,这时候在应用管理器中找到termianl图标,然后双击打开终端
    • no-login shell 运行的脚本文件 .bashrc
  • osx特例
    • 每次运行termianl的时候.默认运行login shell状态
    • osx 的环境变量都写在 .bash_profile

.bashrc .bash_profile 加载顺序

  • .bash_profile .bashrc
装作特别有钱