-1

I would like to run ".sh" files in a directory without having to navigate to that directory, as shown below.

Me trying to run a .sh file, that is not in my current directory:

root@naveen-hp:/home# bash start-master.sh
bash: start-master.sh: No such file or directory

Me trying to run a .sh file by specifying it's location:

root@naveen-hp:/home# bash /usr/local/bin/spark/sbin/start-master.sh
starting org.apache.spark.deploy.master.Master, logging to /usr/local/bin/spark/logs/spark-root-org.apache.spark.deploy.master.Master-1-naveen-hp.out 

So, is there a way to have terminal to also look in /usr/local/bin/spark/sbin/ directory, not just the pwd, when a request to run a .sh file is sent?

1 Answers1

1

You have to add the path you want to contain the script file(s) to you PATH variable.

Look here for example: How to add a directory to the PATH?

wudu
  • 86