当我输入which testWhich ,其中testWhich是~/test文件夹下的可执行文件时,我看到了
/usr/bin/which: no testWhich in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin) 。
我想知道如何将~/test文件夹添加到搜索路径中which这样我就可以在终端的任何地方执行testWhich 。
When I type which testWhich, where testWhich is an executable file under ~/test folder, I see
/usr/bin/which: no testWhich in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin).
I'd like know how to add ~/test folder into the search path of which so that I can execute testWhich anywhere in the terminal.
最满意答案
如在其中的联机帮助页:
它通过在PATH中搜索与参数名称匹配的可执行文件来完成此操作。
你应该在你的PATH环境变量中添加〜/ test。 使用以下命令在bash shell上执行此操作:
export PATH =〜/ test:$ PATH
As in the manpage of which:
it does this by searching the PATH for executable files matching the names of the arguments.
you should added ~/test to your PATH environment variables. for doing it on bash shell, using the following command:
export PATH=~/test:$PATH
更多推荐
发布评论