如何在文件 .bashrc 中向 PATH 添加目录? [英] How to add a directory to PATH in the file .bashrc?

查看:60
本文介绍了如何在文件 .bashrc 中向 PATH 添加目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装 python(EPDFee) 后,我想将/bin 目录添加到 $PATH 变量中.我正在使用 bash shell.我发现我必须在文件 .bashrc

After installing python(EPDFee), I want to add the /bin directory to $PATH variable. I am use bash shell. I have found that I have to add the following line in the file .bashrc

export PATH=/home/usrname/epd/bin:$PATH

我找到了 .bashrc 文件,内容为

I have found the file .bashrc, it reads

PATH=$PATH:/opt/bin

# 由 Canopy 安装程序于 2014-03-29 添加

# VIRTUAL_ENV_DISABLE_PROMPT 可以设置为 '' 使 bashprompt 显示 Canopy 处于活动状态,否则为 1

VIRTUAL_ENV_DISABLE_PROMPT=1 source/home/an/Enthought/Canopy_64bit/User/bin/activate

你能告诉我在哪里可以将 export PATH=/home/usrname/epd/bin:$PATH 添加到或应该添加到另一个文件中吗?

Could you please tell me where can I add export PATH=/home/usrname/epd/bin:$PATH to or is should be added in another file?

推荐答案

你可以这样做:定义一个 EPD_HOME 变量并将其附加到 PATH

You can do it like this : Define a EPD_HOME var and append it to PATH

EPD_HOME=/home/usrname/epd/bin    
PATH=$PATH:$EPD_HOME:$HOME/bin
export PATH

请注意,$EPD_HOME 变量位于 PATH 变量中,一旦您在计算机上打开与用户的连接,就会加载该变量.

Notice that the $EPD_HOME variable is in the PATH variable and is now loaded once you open a connection to your user on the machine.

这篇关于如何在文件 .bashrc 中向 PATH 添加目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆