linux - 如何在 .profile 或 .bash_profile 中设置 PATH in ubuntu

标签 linux bash shell ubuntu path

我有一个使用 jmeter 的脚本。现在,我不想在脚本中给出路径,例如 sh/home/ubuntu/apache-jmeter-3.0/bin/jmeter.sh -n -t fileName.jmx 我只想给出sh jmeter.sh -n -t fileName.jmx 在脚本中。所以,我想在 ubuntu 中设置 jmeter 的 PATH。我不明白该怎么做。有人可以帮忙吗。

我的 jmeter 路径是:/home/ubuntu/apache-jmeter-3.0

最佳答案

将目录 /home/ubuntu/apache-jmeter-3.0/bin 添加到您的路径中:

export PATH="$PATH":/home/ubuntu/apache-jmeter-3.0/bin

然后就可以直接使用了:

jmeter.sh -n -t fileName.jmx

要使其永久化,请将新的 PATH 声明添加到您的 ~/.bashrc

关于linux - 如何在 .profile 或 .bash_profile 中设置 PATH in ubuntu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38151964/

相关文章:

bash - 如何从文件名中获取字符串并将其用作参数

linux - 显然由于 "spark-submit"参数(具有 * 通配符)未扩展,无法通过系统调用从 scala 中调用 "--jars"

linux - 删除 shell 中以某个字符开头的行,但保留负值

java - 无法在树莓派上运行java程序

linux - bash 中的 case 语句替代方案

linux - 为什么 git bash 不将我的 python 安装的路径转换为 ​​nix 表示法?

linux - 这个 shell 脚本代码是什么意思

linux - resize2fs 的返回/退出代码是什么?

linux - 在 linux 中查看另一个目录中文件的完整路径?

bash - Erlang 和 bash 脚本(escript)