红联Linux门户
Linux帮助

PATH环境变量的设置

发布时间:2006-08-30 00:39:31来源:红联作者:MORR
系统级的环境变量在/etc/profile中进行设置,如加入“/usr/local/apache2/bin”这个路径条目,可以像如下设置:

[code]# /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[/code]
文章评论

共有 1 条评论

  1. samblue 于 2006-08-30 13:28:58发表:

    收下了,谢谢