#! in shell scripts

Erik E. Fair fair at dual.UUCP
Tue Mar 6 12:41:19 AEST 1984


I have it on good authority that the #! kernel hack for making shell
scripts directly executable is a 32Vism. Since 4BSD is a 32V derivative,
it has it. Since System III and V are not 32V derivatives, they don't.

For the users of 4BSD systems: If you want to write Bourne Shell scripts,
go ahead. But if you ever have the notion to port them to USG Systems, or
V7 Systems, your scripts will fail for all users of csh, which assumes
that a shell script with `#' at the beginning is a csh script, and not
a sh script. Better that you do something like this:

: This comment line will do the right thing for all versions of UNIX,
: if you like Bourne Shell Scripts.
PATH=/foo/bar:/snafu/bin:/etc:; export PATH

and so on, ad nauseum.

	Erik E. Fair

	dual!fair at BERKELEY.ARPA
	{ihnp4,ucbvax,cbosgd,decwrl,amd70,fortune,zehntel}!dual!fair
	Dual Systems Corporation, Berkeley, California



More information about the Comp.unix mailing list