bash 如何在 ubuntu 中的 .profile 或 .bash_profile 中设置 PATH
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38151964/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set the PATH in .profile or .bash_profile in ubuntu
提问by user6348718
I have a script which uses jmeter. Now, instead of giving the path in the script like sh /home/ubuntu/apache-jmeter-3.0/bin/jmeter.sh -n -t fileName.jmx
in the script I just want to give sh jmeter.sh -n -t fileName.jmx
in the script. So, I want to set up the PATH of the jmeter
in ubuntu
. I didn't understand how to do it. Can some one help.
我有一个使用 jmeter 的脚本。现在,不是像sh /home/ubuntu/apache-jmeter-3.0/bin/jmeter.sh -n -t fileName.jmx
在脚本中那样在脚本中提供路径,我只想sh jmeter.sh -n -t fileName.jmx
在脚本中提供。所以,我想设置jmeter
in的 PATH ubuntu
。我不明白该怎么做。有人可以帮忙吗。
Path to my jmeter is: /home/ubuntu/apache-jmeter-3.0
我的 jmeter 的路径是: /home/ubuntu/apache-jmeter-3.0
采纳答案by heemayl
Add the directory /home/ubuntu/apache-jmeter-3.0/bin
to your path:
将目录添加/home/ubuntu/apache-jmeter-3.0/bin
到您的路径中:
export PATH="$PATH":/home/ubuntu/apache-jmeter-3.0/bin
Then you can use it directly:
然后就可以直接使用了:
jmeter.sh -n -t fileName.jmx
To make it permanent, add the new PATH
declaration to your ~/.bashrc
.
要使其永久化,请将新PATH
声明添加到您的~/.bashrc
.