Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!wuarchive!cs.utexas.edu!romp!auschs!awdprime!sanders.austin.ibm.com!sanders From: sanders@peyote.cactus.org (Tony Sanders) Newsgroups: comp.unix.shell Subject: Re: One line If-then-else block in csh possible? Keywords: csh programming Message-ID: <5393@awdprime.UUCP> Date: 17 Feb 91 03:08:37 GMT References: <1991Feb13.180658.16244@msuinfo.cl.msu.edu> <1991Feb16.142134.19813@convex.com> Sender: news@awdprime.UUCP Reply-To: sanders@peyote.cactus.org (Tony Sanders) Distribution: comp Organization: IBM AWD, Austin Lines: 19 Originator: sanders@sanders.austin.ibm.com In article <1991Feb16.142134.19813@convex.com> tchrist@convex.COM (Tom Christiansen) writes: >From the keyboard of harichan@eecae.uucp (Ronald Harichandran): >:Is it possible to have an if-then-else-endif block on a single line? Sure, no problem: sh -c 'if [ 0 != 0 ]; then echo true; else echo false; fi' :-) >You can often work something out using /bin/test and the short-circuit >booleans: > > [ some test ] && success || failure so much for builtin test. >In general, your happiness with csh will be inversely proportional to how >much you try to do with it. But it's so much fun trying to get it to work. -- sanders@peyote.cactus.org First rule of software: Throw the first one away. and so on...