-2

I wrote a bash script and am trying to execute it from sh but I am getting a "permission denied error". I set to permissions to 777 but it is still preventing me from executing the file.

# which sh
/bin/sh
# ls -l myscript.sh
-rwxrwxrwx    1 root  wheel  974 Nov  4 09:16 myscript.sh
# ./myscript.sh
zsh: permission denied: ./myscript.sh

Any help would be greatly appreciated.

stevo
  • 171
  • 5
  • 16

1 Answers1

3

Not sure what could be the reason but try invoking shell explicitly passing your script as argument/command to the Shell like sh myscript.sh

Rahul
  • 76,197
  • 13
  • 71
  • 125