解决Linux环境变量每次要source /etc/profile问题
在 /etc/profile 里配置的环境变量只要退出后都需要再 source /etc/profile 才会生效解决办法:编辑vi ~/.bashrc 再最后面增加修改完要重新启动系统1、方法一把export语句写在 ~/.bashrc 文件里,或者在该文件里写上 source /etc/profile指令:vim ~/.bashrc 或者 vi ~/.bashrc“~” 指当前账号的根目录“.
·
2、方法二(自测有效)
在 /etc/profile 里配置的环境变量只要退出后都需要再 source /etc/profile 才会生效
解决办法:
编辑vi ~/.bashrc 再最后面增加
if [ -f /etc/profile ]; then
. /etc/profile
fi
修改完要重新启动系统
1、方法一
把export语句写在 ~/.bashrc 文件里,或者在该文件里写上 source /etc/profile
指令:vim ~/.bashrc 或者 vi ~/.bashrc
“~” 指当前账号的根目录
“.” 表示bashrc是隐藏文件,可以用 ls -a 或 ls -la命令看到
解决办法:
编辑vi ~/.bashrc 再最后面增加
# add source /etc/profile
source /etc/profile
更多推荐



所有评论(0)