Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

"Command not found" when running shell script with ./

In Mac OSX 13, Terminal, I am trying to run a shell script, ./writeimage.sh

I cd into the folder,
I see the writeimage.sh file is there with ls -l
I see it’s permissions are set correctly to 700 (rwx for me)
I use the ./ prefix because this script is not in the Path.
I stick a sudo in front, in case there is some privilege issue.

Terminal returns "sudo: writeimage.sh: command not found"

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I’m out of ideas – anyone know why this is happening? What am I missing?
Thanks for any help!

-----MacBook-Air Downloads % ls -l
total 543176
..
..
-rwx------@ 1 lf  staff       4402 10 Mar 22:41 writeimage.sh

----Downloads % sudo writeimage.sh -d /dev/disk5s1 -i "motioneyeos-raspberrypi-20200606.img.xz"
Password:
sudo: writeimage.sh: command not found

>Solution :

Check the shebang line:

  • The shebang line at the top of the script specifies which interpreter should be used to run the script. Make sure this is correct for your system.
  • For example, if you are using bash, the shebang line should be #!/bin/bash.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading