From: Nick Stoughton <yyyyy@xxxxxxxxxxxxxxx>
On your second question you have a good point, though the "#!" stuff is not
a part of the spec. Therefore, a perl script (or any other script) is not a
portable utility and is therefore out of scope; by this definition they are
not utilities. There is no mechanism in the standard to support any type of
utility that is not either a binary or shell script.
Is not the whole distinction artificial and unnecessary?
This binary does not run on its own - it requires a dynamic
loader and linker and all kinds of auxiliary programs.
Precisely which supporting loaders are invoked may depend on
whether the binary is COFF or ELF or whatever.
So what happens is that the system looks at the binary, decides
what libraries, loaders and linkers must be invoked to let it run.
Viewed in this way, a perl script is a binary (with an interesting
object format, recognized by the system because it has a magic number
namely `#!/usr/local/bin/perl' or so).
Thus, even though the standard does not mention the #! construction
(yet), one need not come to the conclusion that such scripts are
unsupported. Just like a COFF binary, a perl script is a file with
unspecified contents for which the exec call succeeds.
Of course this does not guarantee that the same perl script
is portable to some other machine. But that is not guaranteed
about the COFF binary either.
In other words, one could write
Utility:
A program that can be called by name from the shell to perform
a specific task or related set of tasks. This program is either
an executable file or a file of shell source code ...
without specifying exactly what properties are required
for a file so that it can be successfully executed.
Andries
|