csh question
Barry Evans
evans at wivax.UUCP
Thu Mar 1 03:07:50 AEST 1984
Someone posted an article stating they had a problem with the following
csh script, and someone else posted a followup stating there
was an incorrect number of endif's. Not so. Removing one of the
endif's is a hack, which just happens to work. I'm convinced that
there is a bug in Csh, and that the logic in the script is correct.
Reason being, if you include a whitespace after the if's, then the
following script works as it is supposed to. I haven't seen anything in the
documentation saying that you must include white-spaces though. Also,
in expressions, you must include spaces before and after the
conditions, which the documentation doesn't mention either, but for these
you will get error messages.
#! /bin/csh {
set x=1 x=1;
if($x == 1) then if(x == 1){
set y=2 y=2;
else }else{
if($y == 2) then if(y == 2){
echo "line 1" printf("line 1");
else }else{
echo "line 2" printf("line 2");
endif }
echo "shouldn't get here" printf("shouldn't get here");
endif }
echo "finished" printf("finished");
}
-barry
--
Barry Evans {apollo, cadmus, decvax, linus}!wivax!evans
Wang Institute (617) 649-9731 x383
More information about the Comp.unix.wizards
mailing list