🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #32

Re: csh problem involving nested ifs?

#32
From: Brian V. Smith
Date: Mon, 10 Jul 1989 18:39
31 lines
1685 bytes
In article <TALE.89Jul10131139@imagine.pawl.rpi.edu>, 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!
Technical Details
Message-ID: <2975@helios.ee.lbl.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!helios.ee.lbl.gov!epb2.lbl.gov!envbvs
References: <TALE.89Jul10131139@imagine.pawl.rpi.edu> <685@wuphys.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <TALE.89Jul10131139@imagine.pawl.rpi.edu> <685@wuphys.UUCP>
Sender: usenet@helios.ee.lbl.gov
Distribution: comp
Lines: 31