Re: Executable shell scripts

From: CaT
Date: Sat May 13 2006 - 07:22:34 EST


On Sat, May 13, 2006 at 01:03:24PM +0200, Mark Rosenstand wrote:
> It doesn't:
>
> bash-3.00$ cat << EOF > test
> > #!/bin/sh
> > echo "yay, I'm executing!"
> > EOF
> bash-3.00$ chmod 111 test
> bash-3.00$ ./test
> /bin/sh: ./test: Permission denied

Obviously.

It executes the script, finds that it needs an interpreter and runs /bin/sh
as specified telling it to run the script. /bin/sh though needs to read
the script in and since the script has no read permissions it fails.
Hence permission denied.

--
"To the extent that we overreact, we proffer the terrorists the
greatest tribute."
- High Court Judge Michael Kirby
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/