nested ifs' in csh dont work?
Grant Collins
grant at saturn.cs.swin
Thu May 31 17:07:31 AEST 1990
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?
More information about the Comp.sys.sun
mailing list