Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!psuvax1!rutgers!njin!princeton!twg.com!david From: david@twg.com (David S. Herron) Newsgroups: comp.sys.amiga.advocacy Subject: Re: How to improve Workbench 2.0! Message-ID: <8659@gollum.twg.com> Date: 19 Feb 91 00:14:28 GMT References: <1991Feb11.113601.1338@sugar.hackercorp.com> <9474@uwm.edu> Organization: The Wollongong Group, Palo Alto, CA Lines: 69 In article <9474@uwm.edu> gblock@csd4.csd.uwm.edu writes: >From article <1991Feb11.113601.1338@sugar.hackercorp.com>, by peter@sugar.hackercorp.com (Peter da Silva): >.. Script for Arexx, Execute for standard scripting, and >none set for standard text file... I like it the more I think of it... :) >Take a rest, peter... If you don't like the feature, don't use it. You can >type "execute xxx", and "rx xxxx" if you like... BZZZT!! there's a lot more interpreters (potentially anyway) out there than just "execute" and "rexx". BSD Unix (and now SysVr4 assumably) have had for, a long time, a way of specifying within the file what interpreter to use. For exec(2) on a file which had the "execute" bit turned on and is not a normal object file the first line is read and examined to see if it is like so: #! /path/interpreter args And if so, then /path/interpreter is executed with the file on its stdin. Methinks this is the sort of capability that Peter is wishing for. An odd example that might not occur immediately to you is: #! /bin/egrep ^[^#] some text lines like the following are comments: # this is a comment some more text Which is what I used once long ago for the "pizza" program -- a telephone number of local food places the program which listed the dialup phone numbers for the system At my old job at ms.uky.edu. (Aside: this runs the file through egrep, which is instructed to pass on all lines which do not start with '#'..) (Version 1 of this example used "#! /bin/cat" .. ;-) Another example: perl is available on AmigaDOS. On a BSD Unix machine, to have a perl script executable one simply puts "#! /usr/local/bin/perl" at the head of the file. On AmigaDOS there isn't any way to do this.. so perl programs become second-class citizens in that you have to remember what interpreter to use on the script. Which brings up another point. Why should one have to remember which language an executable script is written in in order to execute it? When running compiled programs one doesn't have to know whether it was written in FORTRAN or C, one just runs it. Why should it be any different for executable scripts? As for how to indicate which interpreter to use: The BSD Unix method is pretty darn good but some of you Anti-Unix puritans might not like it. An advantage of putting it into the file like this is that when you edit the file you know right away which interpreter it is. There is a small problem of backwards compatibility with AREXX scripts. That is, there is/was a convention that you start 'em with "/* comment */" so that WShell will recognize that it's an AREXX script. There was a similar "flag day" when BSD Unix added the executable script support, and somehow we made it out of that thicket alive. ;-) Therefore I really think this is a non-problem .. David -- <- David Herron, an MMDF & WIN/MHS guy, <- Formerly: David Herron -- NonResident E-Mail Hack <- <- MS-DOS ... The ultimate computer virus.