Linux Mint.
Ok, this is going to be seriously basic but for some reason, I am mis-understanding how this works.
If I type the following commands, everything works fine:
cd home/user/folder1/folder1/
sudo openvpn --auth-nocache --config /home/user/folder2/folder2/config-file.ovpn
I input the sudo password and all is good.
If I put these commands into a script file, I get nothing but 'command not found'.
I have placed the script file in a folder, added both the script AND the opvn folders to the path.
I created a new script (without the paths) in the same folder as the opvn files, ran it from there and fail.
sudo opvn-script.sh
[sudo] password for <user>:
sudo: opvn-script.sh: command not found
What I don't understand is the script file itself can't be the thing 'not found' because it auto-completes after I type a the first few characters and hit tab. openvpn can't be the 'not found' because I can run the commands straight up.
The script file IS marked as executable.
echo $PATH
shows both folders in the path.
What the heck is left??
opvn-script.sh
is in the PATH for the current user but not for root. Try:sudo /path/to/opvn-script.sh
sudo /path/to/opvn-script.sh
for you. Another might be just to moveopvn-script.sh
to some convenient place on root's current PATH.