Shell programming style -- a plea for better shell scripts

chris at umcp-cs.UUCP chris at umcp-cs.UUCP
Fri Mar 2 12:55:18 AEST 1984


One more note.  Apparently, someone is saying that "gee I want to
run the user's ``xyzzy'' program but the /bin ``test'' program",
and for that reason can't put

	#! /bin/sh
	PATH=/usr/bin:/bin

at the beginning of ``sh'' scripts.  Well don't despair, there is a
solution.  Try

	#! /bin/sh
	lpath=/usr/bin:/bin	# or whatever your shell script needs
	xyzzy			# use the user's xyzzy program
	PATH=$lpath if test ...	# don't use the user's test program

I can't say if it works on System III or System V, but it works under
4.1.  (I just tested it.)

Aren't "temporary environment variables" wonderful?
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris.umcp-cs at CSNet-Relay



More information about the Comp.unix mailing list