I am trying to learn shell on Linux, but I've got a problem which seems confusing.
- My environment is:
- OS: Manjaro 21.2.6 Qonos
- Kernel: x86_64 Linux 5.15.38-1-MANJARO
- Shell: zsh 5.8.1 (x86_64-pc-linux-gnu)
- The problem is:
- I created a file named
foo, and echoed#\!/bin/shto it, and the permission of filefoohas been modified to100by usingchmod. - The file
foodoesn't have the read or write permission indeed, that's for true, - but when I executed the command
./foo, I got the error/bin/sh: ./foo: permission denied.
- I created a file named
So why the Shell knows what the shebang in the file foo is without the read permission ???
If anyone of you can proide any suggesstions, I will be really thankful !