Our class on unix had an a question I did not know the answer to.
"why is it necessary to use ./XXX.sh to execute a bash executable?". I have not been able to find the answer on the web or in our textbook.
Our class on unix had an a question I did not know the answer to.
"why is it necessary to use ./XXX.sh to execute a bash executable?". I have not been able to find the answer on the web or in our textbook.
When you are invoking a command, the shell looks for the command in your $PATH
variable, it will not look into your current directory. So you have to specifically tell the shell where your command is located. In this case, when the command or script is located in your current directory .
, you need to invoke it using ./XXX.sh
. In fact you can invoke scripts not inside your current directory using its full path e.g. /some/path/XXX.sh
or relative to your current working directory e.g. ../../some/path/XXX.sh