./command的.bashrc变量

时间:2011-10-04 15:42:25

标签: linux command executable .bash-profile

在linux中,对于我必须像./command那样运行的命令;如何设置.bashrc环境变量以从任何目录运行command,而无需为命令添加完整路径。

由于

2 个答案:

答案 0 :(得分:1)

只需将目录添加到路径中即可。

教程:Adding a Directory to the Path

答案 1 :(得分:1)

您可以像这样修改PATH环境变量

PATH=${PATH}:/the/directory/to/the/executable
export PATH

请注意,您实际上不能包含可执行文件,这意味着它的完整路径看起来像

/the/directory/to/the/executable/command

对于覆盖常见实用程序的可执行文件,要首先找到可执行文件,您需要颠倒顺序,如此

PATH=/the/directory/to/the/executable:${PATH}
export PATH