登录和退出时shell的执行顺序

来源:互联网 发布:矩阵归一化怎么计算 编辑:程序博客网 时间:2024/06/05 12:02

原文链接http://blog.csdn.net/todd911/article/details/21602079

当你登录一个交互式的login shell时,各shell文件的执行顺序如下:(伪代码表示)

[cpp] view plaincopy在CODE上查看代码片派生到我的代码片
  1. execute /etc/profile   
  2. IF ~/.bash_profile exists THEN   
  3.     execute ~/.bash_profile   
  4. ELSE   
  5.     IF ~/.bash_login exist THEN   
  6.         execute ~/.bash_login   
  7.     ELSE   
  8.         IF ~/.profile exist THEN   
  9.             execute ~/.profile   
  10.         END IF   
  11.     END IF   
  12. END IF   

当你退出一个交互式的shell时,shell文件的执行顺序如下:

[cpp] view plaincopy在CODE上查看代码片派生到我的代码片
  1. IF ~/.bash_logout exists THEN   
  2.     execute ~/.bash_logout   
  3. END IF   


当你登录一个非交互式的non-login shell时,shell文件执行顺序如下:(伪代码表示)

[cpp] view plaincopy在CODE上查看代码片派生到我的代码片
  1. IF ~/.bashrc exists THEN   
  2.     execute ~/.bashrc   
  3. END IF  
0 0
原创粉丝点击