This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: guile bangline
- To: james at tiger-marmalade dot com
- Subject: Re: guile bangline
- From: Michael Vanier <mvanier at bbb dot caltech dot edu>
- Date: Mon, 11 Oct 1999 14:47:26 -0700 (PDT)
- Cc: guile at sourceware dot cygnus dot com
- References: <lzemf169fc.fsf@viz.tiger-marmalade.com>
[James Dean Palmer]
>
>
> I noticed that python scripts use a bangline with /usr/bin/env to
> envoke python - this makes it extremely portable to systems where
> python is not installed in the same place.
>
> I am using three different systems with guile installed in three
> different places - which is rather cumbersome. I was wondering if
> there was a way to use env in conjunction with the guile #! ... !#
> notation? And if this could be done, wouldn't it be a good general
> policy for script writers?
I and other people have brought this up from time to time. So far there
hasn't been a good solution proposed, but the problem isn't with the #!
... !# notation (which is potentially quite useful). The problem seems to
be that:
1) /usr/bin/env can only reliably (e.g. portably) execute one argument in a
#! line. I believe this is a limitation of the #! mechanism, not of env.
2) Running guile on a script requires invoking "guile -s", not just
"guile".
Experts, please correct me if I'm wrong on either of the above two issues.
I've got a quick hack fix: a shell script I call "guiles":
#! /bin/sh
/usr/bin/env guile -s ${1+"$@"}; exit $?
Then you can do this in your guile programs:
#! /usr/bin/env guiles
!#
;; your code here...
This works for me; YMMV. I wish there was a standard way to do this,
though. I don't know why the "-s" option couldn't be the default, for
instance. IMO the current setup puts guile at a significant disadvantage
with respect to other scripting languages, which (again IMO) is more
important than maintaining strict scsh/scm compatibility if we really want
guile to take over the world :-)
Mike
--------------------------------------------------------------
Mike Vanier mvanier@bbb.caltech.edu
Department of Computation and Neural Systems, Caltech 216-76
GNU/Linux: We can't lose; we're on a mission from God.