From mboxrd@z Thu Jan 1 00:00:00 1970 From: mascheck@in-ulm.de (Sven Mascheck) Date: Thu, 15 Dec 2011 00:36:31 +0100 Subject: [TUHS] Command line post-arguments with #! In-Reply-To: <4EE6C1A4.7030107@fastmail.us> References: <20111208230820.GA8547@minnie.tuhs.org> <4EE6C1A4.7030107@fastmail.us> Message-ID: <20111214233631.GA9448@lisa.in-ulm.de> 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).