Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!cbosgd!ihnp4!houxm!mtuxo!hfavr From: hfavr@mtuxo.UUCP (a.reed) Newsgroups: net.unix,net.unix-wizards Subject: Re: Negative if in Bourne (and C) SHELL Message-ID: <1899@mtuxo.UUCP> Date: Sun, 17-Aug-86 20:01:02 EDT Article-I.D.: mtuxo.1899 Posted: Sun Aug 17 20:01:02 1986 Date-Received: Tue, 19-Aug-86 02:45:45 EDT References: <1751@ittatc.ATC.ITT.UUCP> <7028@utzoo.UUCP> <150@humming.UUCP> Organization: AT&T Information Systems Labs, Holmdel NJ Lines: 35 Xref: watmath net.unix:8921 net.unix-wizards:19255 > Here's something I've wanted to do for a while but I can't seem to find the > way to do it. > > In the csh you can do something like > > ls foo > if (! $status) then > echo "foo exists" > endif > > The key thing here is the ability to NOT the value of status. How is > this similar thing done in Bourne shell. > > if ! ls foo > then > echo foo does not exist > fi > > In summary, how can I take the logical NOT of a command's return value in > the Bourne shell (which is God's gift to U**X :-)? > -- > "Life is but a dream" - Lope de Vega > "...for some and a NIGHTMARE for others!" Merlin, "Excalibur", the movie > Disclaimer? What disclaimer? I can back everything up with as much > drivel as you like! Use "else", i.e.: if ls foo then echo '\c' else echo foo does not exist fi Adam Reed (ihnp4!npois!adam)