in reply to perlscript as she-bang line

The shebang line is handled by the kernel, not the shell. A script after the shebang line is not allowed.

From the execve(2) manpage:

execve() executes the program pointed to by filename. filename must be either a binary executable, or a script starting with a line of the form "#! interpreter [arg]". In the latter case, the interpreter must be a valid pathname for an executable which is not itself a script, which will be invoked as interpreter arg filename.

Replies are listed 'Best First'.
Re^2: perlscript as she-bang line
by saintmike (Vicar) on Dec 28, 2004 at 23:40 UTC
    That's what I thought as well, but that's obviously not the case, as the difference between zsh and bash shows.

      Ah, I didn't read your node carefully, and failed your comment about zsh.

      Well, it's zsh then. From info zsh "Command Execution":

      If execution fails because the file is not in executable format, and the file is not a directory, it is assumed to be a shell script. /bin/sh is spawned to execute it. If the program is a file beginning with `#!', the remainder of the first line specifies an interpreter for the program. The shell will execute the specified interpreter on operating systems that do not handle this executable format in the kernel.