Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mcvax!hp4nl!phigate!nlgvax!hans
From: hans@nlgvax.UUCP (Hans Zuidam)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Elinating the 'rx' from AREXX
Message-ID: <276@nlgvax.UUCP>
Date: 13 Aug 89 09:48:49 GMT
References: <1989Aug8.214011.3351@agate.berkeley.edu> <479@tw-rnd.SanDiego.NCR.COM> <89222.093949UH2@PSUVM> <19146@usc.edu>
Organization: Philips Research Laboratories, Geldrop
Lines: 54

addison@pollux.usc.edu (Richard Addison) writes:
>If I remember correctly, /bin/sh is the default shell for executing scripts
>unless another shell is specified on the first line.
Nope.

A UNIX shell looks at the first two bytes of the file you try to execute.
These two bytes together make up the 'magic word'. Each UNIX machine should
have its own magic words assigned. See /usr/include/sys/exec.h on a Sun or
Ultrix machine, on SysV it is somewhere else (a.out.h?).

When the magic word is not that of a code (executable) file the exec call to
the kernel will fail and the current shell assumes the file is a script and
tries to interpret it accordingly. Try this by executing a Sun binary on a
VAX or vice versa. You will get a syntax error from the shell.

Now the '#!' combination is a BSD special. It is documented nowhere (at
least the last time I looked 2 years ago ;-) ). When the first two
characters of a file passed to the loader are '#!', the *loader* takes
everything upto the fist newline as the name of an executable to pass the
rest of the file to. The executable is started and the current file is
passed on its standard input.

In my humble opinion this is not how the Amiga should do it. The Amiga
way of doing things would be to have a separate process for each loader
format, just as there is a separate task for each device instantation,
for each (2 :-) ) file system and so on. A much more opener design would
be to have a hierarchy of loaders with one master which knows how to
scatter load segments. If it couldn't load a file (because it is not an
executable) it would pass the file on to the next in the chain. This
could effectively remove the dependency between a command interpreter
and the rest of the system. Please not that I am *not* saying that it
is easy to design such a sub-system, but I have faith in the expertise
of Amiga's sw designers (;-) ).

By line:
The UNIX ps and /dev/kmem and /unix setup is *not* elegant. Someone said
it was, but I urge you to read the first article on theedesign of UNIX by
K&R in the BTJ (Bell Technical Journal). They chose for /dev/kmem because
in that way you don't have to supply all sorts of system-calls to get
information on the state of the kernel, Thus saving space. Back in the
old days it quite normal to patch the kernel with adb to modify an option.
On the Amiga running down lists is quite ok. They (and the operations on
lists) are standarised. The exact reference to the article is left as an
excersise for the interrested reader, as they say.

						Hans

Opinions above are mine, of course. Spelling errorz are probably cosed
by an over enthusiastic vi macro.
-- 
Hans Zuidam                                    E-Mail: hans@pcg.philips.nl
Philips Telecommunications and Data Systems,   Tel: +31 40 892288
Project Centre Geldrop, Building XR
Willem Alexanderlaan 7B, 5664 AN Geldrop       The Netherlands