Re: #! incompatible -- binfmt_script.c broken?

H. Peter Anvin
2002-12-04T22:21:16Z

Followup to: <E18JgHI-0006Gx-00@chiark.greenend.org.uk>
By author: Matthew Garrett <mgarrett@chiark.greenend.org.uk>
In newsgroup: linux.dev.kernel
>
> The *only* thing you can reliably use in #! lines is an interpreter
> followed by a single argument with no trailing space. On NetBSD with
> bash as /bin/sh:
>
> mjg59@cysteine:/tmp$ cat foo.pl
> #!/bin/sh -- # -*- perl -*- -p
> mjg59@cysteine:/tmp$ ./foo.pl
> /bin/sh: -- # -*- perl -*- -p: unrecognized option
>
> File a bug against perlrun(1).
>

I personally think that it would be nice to split it by spaces (but
yes, ' " and \ need to be handled for this to work.) It allows things
like using env to spawn a binary where the location of the interpreter
is to be extracted from PATH, for example.

-hpa
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt <amsp@zytor.com>