首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

UNIX中为什么重启或者注销之后,之前插入的环境变量PATH的值恢复到启动前的状态,该怎么解决

2012-03-14 
UNIX中为什么重启或者注销之后,之前插入的环境变量PATH的值恢复到启动前的状态如题。也就是说,之前插入的值

UNIX中为什么重启或者注销之后,之前插入的环境变量PATH的值恢复到启动前的状态
如题。
也就是说,之前插入的值不见了。
求解

[解决办法]
你之前是用export设的环境变量吧,这种环境变量在再一次登录的时候就会失效的。更改profile文件才能使环境变量持续有效
[解决办法]

C/C++ code
# /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 ...
[解决办法]
不要用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中是这样子的。
C/C++ code

# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
[ -……

[解决办法]
没有加到.profile 里就可以了,要生效source .profile
[解决办法]
change /etc/profile or /etc/profile.local ?

热点排行