On 2016-01-21 01:25 +0000, Rainer Weikusat wrote:
Rainer> That's a LSB invention. It's a grotesque travesty as it uses
Rainer> 'magic comments' to embed a declarative mini programming
Rainer> language in an init script which is only ever used when
Rainer> modifying the runlevel configuration. Comments are supposed to
Rainer> be used for relatively short, free-style documentation embedded
Rainer> in code, not for interpretation by programs.
Ian> There's precedent for this - the magic shebang lines perl, tcl, guile
Ian> etc. use to get their grubby hands on a script that is masquerading as a
Ian> plain shell script.
Rainer> The kernel uses #! as two-byte magic number to mean 'whatever follows
Rainer> that is the interpreter supposed to interpret this file'[*]. It doesn't
Rainer> execute scripts. Hence, it doesn't define 'scripting language syntax
Rainer> elements'.
To be clear, in the paragraph you've quoted I was _not_ talking about plain
shebangs such as
#! /usr/bin/perl -f
#! /usr/bin/tclsh
(although then I was, in the next paragraph which you haven't quoted).
Rather, I had in mind the serious contortions scripts used to go to
when, for some reason, they _didn't_ rely on the kernel for executing
the interpreter. Even today, the perlrun(1) manpage half-recommends
this:
#!/bin/sh
#! -*-perl-*-
eval 'exec perl -x -wS $0 ${1+"$@"}'
if 0;
Now _this_ may in fact be a travesty :-)
--
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.