csh problem involving nested ifs?

Brian V. Smith envbvs at epb2.lbl.gov
Tue Jul 11 04:39:02 AEST 1989


In article <TALE.89Jul10131139 at imagine.pawl.rpi.edu>, tale at pawl.rpi.edu (David C Lawrence) writes:
< Yes it's a bug, no it's not a bug.  It's one of those ambivalent
< things.  If you know what it is, you adjust your style by one
< character or so and life goes on correctly again.
< 
< Major hacking on the script follows ...
< Marty> #! /bin/csh
< [...]
< Marty> if($v1 == 1) then
< Marty> 	echo checkpoint 1
< Marty> 	if($v2 == 1) then
< [...]
< Marty> 	if($v2 == 1) then
< [...]
< 
< If you change the "if(" to "if (" in each of the nested conditionals
< you should find that your problem has vanished.  The problem is that
< whitespace becomes significant within the first if block, at least as
< far as further nested if blocks are concerned.  The parser used within
< the if block is not the same one which parsed out the top if.

I *didn't* include the spaces as David recommends, and I still didn't see
the problem under Ultrix 2.0 OR Ultrix 3.0. The script (and, hence csh)
works fine.

I used "cut/paste" with X to copy the script, so I know I didn't make any typos.
_____________________________________

Brian V. Smith    (bvsmith at lbl.gov)
Lawrence Berkeley Laboratory
We don't need no signatures!



More information about the Comp.unix.wizards mailing list