I am running the script from inside the directory that contains it and doing so via sudo.

$ sudo launch_16GB.sh
sudo: launch_16GB.sh: command not found
$ ls
actions    contrib         functions       launch_8GB.sh  README.md
clean.sh   drivers         iso             launch.sh
config.sh  dumpkeys.cache  launch_16GB.sh  MAINTAINERS

As you have run the command sudo assumes you want it to look in the directories defined by the PATH variable. If the command was sudo ./launch_16GB.sh, sudo would know to look in the current directory.

  • 4
    In the default configuration, sudo searches its own secure_path, as defined in /etc/sudoers, rather than either the invoking user's or root's PATH – steeldriver Nov 3 '17 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.