[TUHS] Command line post-arguments with #!

Norman Wilson norman at oclsc.org
Thu Dec 15 09:57:39 AEST 2011

Sven Mascheck:

  Well the original implementation (post 7th ed and 4.0/4.1 BSD)
  didn't allow arguments at all ;-)


I believe you're mistaken.  All the implementations I've
ever used allowed a single argument in the #! line,
and inserted the name of the script between that (if
present) and the arguments given to exec.

e.g. if ./lipsum began with

	#!/usr/bin/awk -f

awk would be invoked with `/usr/bin/awk -f ./lipsum ...'.

Without allowing one argument for -f or the like,
#! wouldn't have been useful for much but the shell.

Norman Wilson
Toronto ON

More information about the TUHS mailing list