Subject: Re: Scheme for Unix programming/scripting
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1999/03/23
Newsgroups: comp.lang.scheme
Message-ID: <7d71fu$6o4@fido.engr.sgi.com>
Bengt Kleberg <bengt@softwell.se> wrote:
+---------------
| MzScheme
| #! /bin/sh
| string=? ; exec /usr/plt/bin/mzscheme -r $0 $0 ${1+"$@"}
| (vector-ref argv 1)
+---------------

AFICT, the only reason they do that complicated shell double bounce is for
platform independence, for the few platforms that don't support "#!" scripts
and so they can put wrappers around Scheme scripts for DOS & friends.
If you know that your system supports "#!", MzScheme works perfectly
well with this simpler template, which I use all the time:

    #!/usr/local/bin/mzscheme -r
    (vector-ref argv 0)

[where "/usr/local/bin/mzscheme" is a copy of the *actual* binary, not
their runtime architecture-dispatching script.]

Note however, that in this case the first arg will be in the
*zero*-th element of variable "argv", and that there will be no
easy way to get at the script name itself (the global variable
"program" will contain "/usr/local/bin/mzscheme").


-Rob

-----
Rob Warnock, 8L-855		rpw3@sgi.com
Applied Networking		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
2011 N. Shoreline Blvd.		FAX: 650-964-0811
Mountain View, CA  94043	PP-ASEL-IA