Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!spool.mu.edu!samsung!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!fuug!demos!avg From: avg@hq.demos.su (Vadim Antonov) Newsgroups: comp.unix.internals Subject: Re: csh pleasures Message-ID: <1991Feb8.160901.7474@hq.demos.su> Date: 8 Feb 91 16:09:01 GMT References: <10880@pasteur.Berkeley.EDU> Organization: DEMOS, Moscow, USSR Lines: 34 In <10880@pasteur.Berkeley.EDU> tve@sprite.berkeley.edu (Thorsten von Eicken) writes: >Question: what does the following c-shell script print out? >Anybody care defending? > #!/bin/csh -f > set a=0 > set b=1 > if($a) then <<<<<< look at here. avg. > if($b) then <<<<<< > echo one > else > echo two > endif > else > echo three > endif >Thorsten von Eicken - tve@sprite.berkeley.edu It's the long lived bug in C-shell's parser - I've fixed it a couple of years ago in the revision of C-shell for DEMOS systems. The simpliest way to avoid this bug is to put spaces before and after (). (After fixing this bug I still always put extra spaces - someone could call it "a cargo-cult programming" :-). Vadim Antonov DEMOS, Moscow, USSR ObBug :-) Older versions of C-shell had && and || exchanged - to the extra fun of novices!