./command 的 .bashrc 变量
在linux中,对于我必须运行的命令,如 ./command
;如何设置 .bashrc 环境变量以从任何目录运行命令,而无需输入命令的完整路径。
谢谢
In linux, for a command that I have to run like ./command
; how do I set a .bashrc
environment variable to run the command
from any directory without having to put the full path for the command.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需将目录添加到路径中即可。
教程:将目录添加到路径
Just add the directory to the path.
Tutorial: Adding a Directory to the Path
您像这样修改 PATH 环境变量
请注意,您实际上不能包含可执行文件,这意味着它的完整路径看起来像
对于覆盖通用实用程序的可执行文件,要首先找到可执行文件,您需要颠倒顺序,如下所示
You modify the PATH environmental variable like so
Note that you cannot actually include the executable, which means it's full path would look like
For executables that override common utilities, to make the executable be found first, you need to reverse the order, like so