当前位置: 技术问答>linux和unix
紧急求救:各位大哥,我这样设置环境变量对了吗?谢谢!
来源: 互联网 发布时间:2015-12-28
本文导语: 请教: 我是按照 http://blog.csdn.net/yousoft/archive/2004/08/07/67870.aspx 来设置的 它上面的要求是在主目录的下的 .profile 或 (.login )下修改 在.profile文件(如果你的shell是bash、ksh、zsh或者sh)中,添加下面这些行: QTD...
请教:
我是按照
http://blog.csdn.net/yousoft/archive/2004/08/07/67870.aspx
来设置的
它上面的要求是在主目录的下的 .profile 或 (.login )下修改
在.profile文件(如果你的shell是bash、ksh、zsh或者sh)中,添加下面这些行:
QTDIR=/usr/local/qt
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH
但是我的主目录下没有 .profile 和 (.login ),
所以我在 ect/profile 下修改。
现在:
ect/profile 是:
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
if [ $EUID = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
"profile" 49L, 840C
我把它修改为:
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
if [ $EUID = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
QTDIR=/usr/local/qt
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH
pathmunge /usr/X11R6/bin after
"profile" 49L, 840C
各位大哥
我修改对了吗?
修改后,是不是要reboot ?
谢谢!
我是按照
http://blog.csdn.net/yousoft/archive/2004/08/07/67870.aspx
来设置的
它上面的要求是在主目录的下的 .profile 或 (.login )下修改
在.profile文件(如果你的shell是bash、ksh、zsh或者sh)中,添加下面这些行:
QTDIR=/usr/local/qt
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH
但是我的主目录下没有 .profile 和 (.login ),
所以我在 ect/profile 下修改。
现在:
ect/profile 是:
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
if [ $EUID = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
"profile" 49L, 840C
我把它修改为:
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
if [ $EUID = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
QTDIR=/usr/local/qt
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH
pathmunge /usr/X11R6/bin after
"profile" 49L, 840C
各位大哥
我修改对了吗?
修改后,是不是要reboot ?
谢谢!
|
source /etc/profile
就会使用新的配置
就会使用新的配置