Forcing /bin/sh in a script under V/386 3.2 Korn shell

Tom Bertelson tbertels at cipc1.Dayton.NCR.COM
Sat Jul 15 03:25:11 AEST 1989


In article <1989Jul11.225839.14835 at ziebmef.uucp> cks at ziebmef.uucp (Chris Siebenmann) writes:
> On a BSD Unix, one could put "#! /bin/sh" at the start of your script
>and it would work. Unfortunately, System V doesn't have this (and
>worse yet, your vendor has gratuitusly hacked csh so many scripts will
>break under it), so the best substitute (swiped from Perl v2's
>Configure script) is:
>
>	(alias) >/dev/null 2>&1 && (exec /bin/sh $0 ${1+"$@"})

A minor nit.  If you have an interactive program called "alias" on
your system (as I discovered here) you could be in for a surprise.
Try instead

	(PATH= alias) >/dev/null 2>&1 && (exec /bin/sh $0 ${1+"$@"})

Some day I'll send this off to Larry Wall ...
-- 
Tom Bertelson			DISCLAIMER:  My opinions are my own and
Tom.Bertelson at Dayton.NCR.COM	in no way reflect those of my employer.
...!uunet!ncrlnk!cipc1!tbertels



More information about the Comp.sys.att mailing list