Re: /usr/bin/env and guile

Ralph Schleicher (rs@purple.UL.BaWue.DE)
15 Nov 1997 09:43:13 +0100

Michael Vanier <mvanier@bbb.caltech.edu> cited below with "MV" writes:

MV> Is it possible to start up a guile script with /usr/bin/env? I tried this
MV> but it didn't work on my system:

MV> #!/usr/bin/env guile -s
MV> !#

MV> ...

MV> This prints out an error message, apparently because guile thinks that the
MV> name of the file is a switch. Is there a workaround? Is this a bug or
MV> just a missing feature? It's certainly easier to use env than to type a
MV> long filename (not to mention more portable).

It is highly unportable if you assume that an OS supports more than one
argument with the `#!' feature. The only system which does it is AFAIK
FreeBSD, some systems pass only the first argument, while other systems
pass the remaining line after the first space as the first argument to
the program. The only thing which would help Guile are hacks like Tcl's

#! /bin/sh
#\
exec wish $0 ${1+"$@"}

BTW, do not write `#!/', always write `#! /' (including the whitespace).
There are systems out there treating the first 4 bytes of an executable
as a magic binary number.

-- 
Ralph