Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!ZERMATT.LCS.MIT.EDU!james From: james@ZERMATT.LCS.MIT.EDU (James William O'Toole Jr.) Newsgroups: comp.lang.scheme Subject: Re: Scheme shellscripts Message-ID: <880716144458.6.JAMES@GREEN-GRASS.LCS.MIT.EDU> Date: 16 Jul 88 18:44:00 GMT References: <1666@kalliope.rice.edu> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 39 Date: 16 Jul 88 08:01:32 GMT From: titan!dorai@rice.edu (Dorai Sitaram) A shellscript written in Scheme is like any other Scheme file, except that its first line has to be: runschemescript "$*" ' and its last line: ' The quotes are used to delimit the Scheme code which forms the body of the script. The script consists of a call of the Un*x command `runschemescript' with two arguments, the first being the list of arguments to the Scheme script, and the second the text of the Scheme code in the script. Thus, a Scheme shellscript is a *true* schellscript, i.e., it is callable at the Un*x command-line, though the main part of it is a piece of text which is Scheme. The command `runschemescript' used above is a shellscript written in the usual shell language. It is the following relatively simple piece of cshell: ... If anyone can suggest further improvement I'll be glad to hear of it. Your method, when executed, requires starting one /bin/csh to interpret the shellscript, another /bin/csh to interpret the ``runschemescript'' shellscript, copying the scheme code into a temporary file, and invoking the scheme implementation on that file. I would suggest that you instead place your scheme code in a file whose first line is ``#!/bin/scheme arg''. If your file is called foo, and its first line is as given above, then when you execute foo, your Unix will execute the command ``/bin/scheme arg foo''. You may omit arg, or choose arg to be something which speeds up /bin/scheme, or tells it to load the file whose name follows, or whatever. You will have to convince your scheme to ignore the first line of foo, of course. This method avoids starting up extra shells and copying files. --Jim