当前位置: 技术问答>linux和unix
UNIX中为什么重启或者注销之后,之前插入的环境变量PATH的值恢复到启动前的状态
来源: 互联网 发布时间:2017-01-13
本文导语: 如题。 也就是说,之前插入的值不见了。 求解 | 在# System-wide .profile for sh(1)下面 if [ -x /usr/libexec/path_helper ]; then上面那行加就行 | 你之前是用export设的环境变量吧,这种环境变...
如题。
也就是说,之前插入的值不见了。
求解
也就是说,之前插入的值不见了。
求解
|
在# System-wide .profile for sh(1)下面
if [ -x /usr/libexec/path_helper ]; then上面那行加就行
|
你之前是用export设的环境变量吧,这种环境变量在再一次登录的时候就会失效的。更改profile文件才能使环境变量持续有效
|
不要用export设置环境变量,只对当此有效,在/etc/profile文件中配置你的环境变量。这样才能每次都生效。
# /etc/profile for SuSE Linux
#
# PLEASE DO NOT CHANGE /etc/profile. There are chances that your changes
# will be lost during system upgrades. Instead use /etc/profile.local for
# your local settings, favourite global aliases, VISUAL and EDITOR
# variables, etc ...
# /etc/profile for SuSE Linux
#
# PLEASE DO NOT CHANGE /etc/profile. There are chances that your changes
# will be lost during system upgrades. Instead use /etc/profile.local for
# your local settings, favourite global aliases, VISUAL and EDITOR
# variables, etc ...
|
# /etc/profile for SuSE Linux
#
# PLEASE DO NOT CHANGE /etc/profile. There are chances that your changes
# will be lost during system upgrades. Instead use /etc/profile.local for
# your local settings, favourite global aliases, VISUAL and EDITOR
# variables, etc ...
|
没有加到.profile 里就可以了,要生效source .profile
|
change /etc/profile or /etc/profile.local ?