/etc/profile的执行时间
执行顺序
登录后,执行顺序为:
/etc/profile --> (~/.bash_profile --> ~/.bash_login --> ~/.profile其中存在的第一个)
其中 ~/.bash_profile 脚本内部一般会再调用 . /bashrc,如下:
if [ -f ~/.bashrc ] ; then
. ./bashrc
fi
~/.bashrc 脚本内部一般会调用 /etc/bashrc,如下:
if [ -f /etc/bashrc ] ; then
. /bashrc
fi
执行次数
~/.bashrc: 每次登录及新打开shell时都会执行
/etc/profile: 第一次登录时执行