每次重启需要source /etc/profile的原因

linux主机每次重启后,所有配置的变量均失效;

需要source /etc/profile

命令才有效

原因:

缺少$PATH部分(红圈圈)

可以想想

系统先加载/etc/profile 然后再加载~/.bash_profile,由于开始没有红圈圈那部分,最终的环境变量就只有~/.bash_profile部分;/etc/profile配置的环境变量均无用;

加上就OK了

猜你喜欢

转载自blog.csdn.net/ningyanggege/article/details/86654533