Shell programming style -- a plea for better shell scripts

gwyn%brl-vld at sri-unix.UUCP gwyn%brl-vld at sri-unix.UUCP
Sun Feb 26 08:34:26 AEST 1984


From:      Doug Gwyn (VLD/VMB) <gwyn at brl-vld>

Here are two important considerations for people writing Bourne shell
scripts that may have to be run by other people who perhaps are on a
Berkeley UNIX using the Cshell as a command interpreter:

(1)	The first line of every Bourne shell script should be:

	#!/bin/sh

(2)	Before invoking ANY system commands, set the expected command
	search path.  This is usually:

	PATH=/bin:/usr/bin

	but on BRL UNIXes, UNIX System V compatible shell scripts must
	use the following since /bin and /usr/bin may have incompatible
	commands such as "echo" and "pr":

	PATH=/usr/5bin:/bin:/usr/bin



More information about the Comp.unix mailing list