[TUHS] Command line post-arguments with #!
Sven Mascheck
mascheck at in-ulm.de
Thu Dec 15 09:36:31 AEST 2011
On Mon, Dec 12, 2011 at 10:08:20PM -0500, Random832 wrote:
> Speaking of DEMOS, I was browsing through that a while back (when it
> was first posted here;
I guess this: http://minnie.tuhs.org/pipermail/tuhs/2011-May/002387.html
> I forgot to post about it at the time) and saw a feature that
> doesn't seem to have existed anywhere else that I could find -
> placing interpreter arguments after the command line arguments
> of a script.
> I.e. something like "#!/bin/foo bar $* baz".
Now that looks like a quite special hack to me,
The mentioned d22.tar.gz -> d22/sys/sys.tar.Z -> sys/sys1.c has
# define SCRMAG "#!"
# define SCRMAG2 "/*#!"
# define ARGPLACE "$*"
# define SHSIZE 70
# define ARGV 11
it accepts both #! and /*#! (equivalent), 70 chars, at most
11 arguments, and explains (russian guessed and then omitted here):
usually
script x with "#!CMD A1 A2 A3"
called as "x B1 B2"
results in "CMD A1 A2 A3 /.../.../x B1 B2"
while in D22
script x with "#!CMD A1 $* A2 A3"
called as "x B1 B2"
results in "CMD A1 /.../.../x B1 B2 A2 A3"
> Has any American unix had this?
I haven't seen such anywhere, but not the above until now, either.
But I believe that you can discard those which are listed here
http://www.in-ulm.de/~mascheck/various/shebang/#results
from your list of candidates.
> Some these days won't even allow multiple arguments at all.
Well the original implementation (post 7th ed and 4.0/4.1 BSD)
didn't allow arguments at all ;-) But multiple arguments
definitely is the minority (AFAIK Plan9, some FreeBSD,
MacOSX, Minix, BSD/OS, and some early cygwin).
More information about the TUHS
mailing list