PATH环境变量的设置
时间:2006-08-29 来源:xdev
系统级的环境变量在/etc/profile中进行设置,如加入“/usr/local/apache2/bin”这个路径条目,可以像如下设置:
# /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 [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
# HiWei Path
pathmunge /usr/local/apache2/bin
相关阅读 更多 +