I have the following script in my user's bin directory; let's pretend the filename is 'myScript':
#!/bin/bash
python3 /myPath/myProgram.py "$@"
From the commandline, if I type myScript
, it launches my myProgram.py. If I type sudo myScript
, however it gives me this error: sudo: myProgram: command not found
.
Why doesn't this work? How can I make it work?
Thanks!
sudo /path/to/myScript
sudo ./myScript
. So, yes, with the full path it works. However, putting things in the bin directory makes it so you can run them without typing the path. So, I guess getting it to work with that functionality is what I'm asking about.~/.bashrc