bash启动初始化
为用户设置环境信息。
/etc/profile
~/.bash_profile|~/.bash_login|~/.profile
~/.bashrc
/etc/bashrc
~/.bash_logout
/etc/profile:系统主要的设置文件,重要的环境变量都在此设置,对所有用户都生效。从文件可以看出其会执行/etc/pro file.d/*.sh脚本。bash_profile:每位用户的bash环境变量文件。在执行/etc/profile之后就会读取此文件的设置。包含用户的bin目录。.bash_login:bash_profile文件不存在会尝试读取.bash_login文件的内容。用户登录后bash会读取此文件。.profile:如果有.bash_profile或者.bash_login存在,就不会执行。执行.bashrc。.bashrc:每次执行bash时,此文件都会被再次读取,变量会再次设置。而/etc/profile,bash_profile只有在登录的时候才会读取。所以此文件一般只定义终端机设置及shell提示符号而不是定义环境变量。.bash_logout:设置注销shell前执行的命令。