Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!watmath!clyde!floyd!harpo!seismo!hao!hplabs!sri-unix!eric@cit-vax
From: eric%cit-vax@sri-unix.UUCP
Newsgroups: net.unix-wizards
Subject: nested if's in csh
Message-ID: <16981@sri-arpa.UUCP>
Date: Mon, 27-Feb-84 17:43:43 EST
Article-I.D.: sri-arpa.16981
Posted: Mon Feb 27 17:43:43 1984
Date-Received: Fri, 2-Mar-84 13:31:31 EST
Lines: 32

From:  Eric Holstege 

The following shell script, when run with the four permutations of inputs
t 0 0
t 1 0
t 0 1
t 1 1
works correctly in all cases.

#! /bin/csh -f
set a = $1
set b = $2
if ( $a ) then
    if ( $b ) then
	echo a and b
    else
	echo a and not b
    endif
else
    if ( $b ) then
	echo not a, but b
    else
	echo neither a nor b
    endif
endif

However, if spaces are left out between the "if" and the "(", it no
longer works correctly. Thus the space appears to be the key. This seems
to be a bug.

		    * Eric Holstege  Caltech, Pasadena, CA.
		    * eric@cit-vax