[net.unix-wizards] nested if's in csh -- you need blanks!

idallen@watmath.UUCP (03/02/84)

The routines that scan forward for a closing ENDIF (search and getword)
only recognize words separated by blanks and tabs, unlike the regular
parser, which breaks words on parentheses too.  So, you must say
	if ( ... ) then
		...
	endif
and not
	if( ... ) then
		...
	endif
or
	if ( ... )then
		...
	endif
Otherwise, the scan-forward routines can't find "if(" and ")then" to
nest the if's properly.  Either the regular parser should refuse to
accept "if(", or the scan-forward routines should duplicate the parser's
cleverness.  Considering the amount of double-parsing the CSH Shell
does already, you'd best vote for the first alternative!
-- 
        -IAN!  (Ian! D. Allen)      University of Waterloo

kvm@basser.SUN (Karlos Mauvtaque) (03/04/84)

You need more than blanks, you need to throw away csh and use the
bourne shell.  csh is simply not a good programming language.
stick to csh for your login shell if you must but write your
scripts in bourne shell.