Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!harpo!seismo!hao!hplabs!sri-unix!cepu!scw@ucla-locus From: scw%ucla-locus@cepu.UUCP Newsgroups: net.unix-wizards Subject: re: csh question Message-ID: <16944@sri-arpa.UUCP> Date: Sat, 25-Feb-84 12:53:00 EST Article-I.D.: sri-arpa.16944 Posted: Sat Feb 25 12:53:00 1984 Date-Received: Fri, 2-Mar-84 14:55:03 EST Lines: 27 From: Steve WoodsI'm having trouble with nesting of csh "if-else-endif". In the following ---------------------- #! /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"); } ---------------------- when you run it, you get the "shouldn't get here" message printed out. Does anyone know why? Because you should, look at the ~equivalent 'c' program. the thing is that the endif is much like a closing brace '}'.