Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1a 12/4/83; site rlgvax.UUCP
Path: utzoo!linus!philabs!cmcl2!floyd!harpo!seismo!rlgvax!guy
From: guy@rlgvax.UUCP (Guy Harris)
Newsgroups: net.unix
Subject: Re: Shell programming style -- a plea for better shell scripts
Message-ID: <1701@rlgvax.UUCP>
Date: Fri, 10-Feb-84 17:03:15 EST
Article-I.D.: rlgvax.1701
Posted: Fri Feb 10 17:03:15 1984
Date-Received: Sat, 11-Feb-84 23:22:58 EST
References: <5684@mcvax.UUCP>
Organization: CCI Office Systems Group, Reston, VA
Lines: 27

A couple of minor points:

1) /bin/[ should be linked to /bin/test (on non-USG systems) in order to make

	if [ "$1" = "foo ]
	then
		...
	else
		...
	fi

work; I have seen systems in which /bin/test (which is documented in the V7
manual) works but /bin/[ (which isn't documented, but works if the link is
made) doesn't.

2) The "#" comment convention is only in the 4.xBSD and USG shells; the
standard V7 shell only implements ":" comments - NOTE that it's not
a real comment, but a command which throws its arguments away and returns
an "exit status" of 0 (which is why "while :" works).  You can't say
things like

	: This isn't valid

because the shell gets upset at the unbalanced single quote.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy