Roy Hinkley asked:
I have a shell script file with executable permissions:
-rwxr-xr-x 1 root root 1147 Jan 26 2017 my_script
Even running it as root – fully qualified (path/to/file/my_script) I get the following error:
-bash: my_script: command not found
SELinux is being enforced and the context label is:
unconfined_u:object_r:var_t:s0
But even attempting to execute with SELinux disabled
Current mode: permissive
does not remedy the error. This script has executed as expected in the past.
What am I not understanding – why is this exception being encountered?
Reference:
CentOS release 6.9
My answer:
my_script
is not in your PATH. So you have to provide the path to it when calling it directly.
./my_script
View the full question and any other answers on Server Fault.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.