Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!rice!sun-spots-request From: grant@saturn.cs.swin (Grant Collins) Newsgroups: comp.sys.sun Subject: nested ifs' in csh dont work? Keywords: Miscellaneous Message-ID: <8371@brazos.Rice.edu> Date: 31 May 90 07:07:31 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 33 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 9, Issue 193, message 9 Howdy Netlanders. Is csh supposed to interpret nested if's correctly or not? Most texts seem to indicate that nested if's will work, but the following test script (under SunOS 4.0.3) appears to indicate otherwise: #!/bin/csh -f set a = 2 set b = 2 if($a == 1) then if($b == 1) then echo a=1,b=1 else echo a=1,b!=1 endif else echo ignores from here if($b == 1) then echo a!=1,b=1 else echo a!=1,b!=1 endif echo all the way to endif above endif echo end of script. Output from this script is: a=1,b!=1 all the way to endif above end of script. It appears that the inner else's and endif's are terminating the outer if. Is this a feature or a bug, or have I just missed something fundamental?