user6348718 user6348718 - 5 months ago 47
Bash Question

How to set the PATH in .profile or .bash_profile in ubuntu

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.

Path to my jmeter is:
/home/ubuntu/apache-jmeter-3.0

Answer

Add the directory /home/ubuntu/apache-jmeter-3.0/bin to your path:

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.