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

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

execute /etc/profile 
IF ~/.bash_profile exists THEN 
    execute ~/.bash_profile 
ELSE 
    IF ~/.bash_login exist THEN 
        execute ~/.bash_login 
    ELSE 
        IF ~/.profile exist THEN 
            execute ~/.profile 
        END IF 
    END IF 
END IF 

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

IF ~/.bash_logout exists THEN 
    execute ~/.bash_logout 
END IF 


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

IF ~/.bashrc exists THEN 
    execute ~/.bashrc 
END IF


你可能感兴趣的:(登录和退出时shell的执行顺序)