This question already has an answer here:
I have a rooted phone, and I was playing around with Terminal Emulator. I tried writing a simple shell script (test.sh) :
#!/bin/sh echo "Hello, World!"
Then I opened terminal emulator, cd'd to the directory my script was in, and typed:
and I got a "permission denied" error. So I tried:
Somehow, still permission denied. So I tried (still as root) :
chmod 775 test.sh busybox chmod 775 test.sh busybox chmod +X test.sh
None of the 3 gave errors, but ./test.sh still gave permission denied! As a last resort I tried
That ended up working. Finally.
I'm curious why permission was denied for my own shell script chmodded to 775 when run as root. How can permission be denied for anything as root? How can I fix this and make ./test.sh work?