关于Linux系统下PATH设置方法
假设你要执行的程序路径在 /usr/my下
export PATH=/usr/my:$PATH # .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi export PATH=/usr/my:$PATH
export PATH=/usr/my:$PATH # .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi export PATH=/usr/my:$PATH
保存退出!
[root@stroller root]# source .bashrc
完整例子:
[root@stroller root]# vi .bashrc
# .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi
然后在 fi 后面加下面语句:
export PATH=/root:$PATH
加完后的 .bashrc 内容为:
# .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi export PATH=/root:$PATH
顶(0)
踩(0)
- 最新评论