Xref: utzoo comp.bugs.4bsd:1329 comp.unix.wizards:17205 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!helios.ee.lbl.gov!epb2.lbl.gov!envbvs From: envbvs@epb2.lbl.gov (Brian V. Smith) Newsgroups: comp.bugs.4bsd,comp.unix.wizards Subject: Re: csh problem involving nested ifs? Message-ID: <2975@helios.ee.lbl.gov> Date: 10 Jul 89 18:39:02 GMT References: <685@wuphys.UUCP> Sender: usenet@helios.ee.lbl.gov Distribution: comp Lines: 31 In article , tale@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@lbl.gov) Lawrence Berkeley Laboratory We don't need no signatures!