Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site fortune.UUCP Path: utzoo!watmath!clyde!burl!hou3c!hocda!houxm!ihnp4!fortune!mcneal From: mcneal@fortune.UUCP Newsgroups: net.unix-wizards Subject: Re: re: csh question - (nf) Message-ID: <2640@fortune.UUCP> Date: Tue, 28-Feb-84 15:19:50 EST Article-I.D.: fortune.2640 Posted: Tue Feb 28 15:19:50 1984 Date-Received: Wed, 29-Feb-84 14:18:09 EST Sender: notes@fortune.UUCP Organization: Fortune Systems, Redwood City, CA Lines: 43 #R:sri-arpa:-1694400:fortune:11600069:000:1001 fortune!mcneal Feb 28 10:14:00 1984 I'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"); } ---------------------- You problem is due to the fact that only one 'endif' is needed. The documentation on the csh states: if (expr) then .... else if (expr2) then .... else .... endif Any number of else-if pairs are possible; only one endif is needed. Richard McNeal UUCP: {sri-unix,amd70,hpda,harpo,ihnp4,allegra}!fortune!mcneal DDD: (415)595-8444 USPS: Fortune Systems Corp, 101 Twin Dolphins Drive, Redwood City, CA 94065