Pascal Bourguignon <pjb@informatimago.com> wrote:
+---------------
| Can a shell script be an interpreter for a shell script?
| It doesn't look like it's possible: the interpreter of the
| "interpreter" script is used to interpret the script in the
| "interpreter" script language...
|
| A solution could be to use a shell script compiler, or to
| use a little bootstrap program.
+---------------
My favorite such trampoline is the "env" program.
As it says in the FreeBSD man page:
"env" is sometimes useful with the ``#!'' construct (see execve(2)).
The only difference between "#!/usr/local/bin/foo" and
"#!/usr/bin/env /usr/local/bin/foo" is that the latter works
even if /usr/local/bin/foo is itself interpreted. Using "env"
this way also allows one to reference "foo" without the path,
as well as set up the environment as desired.
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607