Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!topaz!nike!lll-crg!lll-lcc!pyramid!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.unix,net.unix-wizards Subject: Re: question-- Bourne (and C) SHELL Message-ID: <6228@sun.uucp> Date: Fri, 15-Aug-86 18:27:59 EDT Article-I.D.: sun.6228 Posted: Fri Aug 15 18:27:59 1986 Date-Received: Sun, 17-Aug-86 07:32:21 EDT References: <1751@ittatc.ATC.ITT.UUCP> <7028@utzoo.UUCP> <150@humming.UUCP> Organization: Sun Microsystems, Inc. Lines: 37 Xref: watmath net.unix:8913 net.unix-wizards:19239 > 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 Try if ls foo then : else echo foo does not exist fi The ":" is the pseudo-comment from old Bourne shells; it's really a command that does nothing. Not the cleanest syntax, but that's life. (However, I'd rather have a shell that requires that crud, but allows you to redirect the output of a "for" loop, than one that permits you to negate exit status directly but won't let you redirect the output of loops! At least with the Bourne shell you can get around the inability to negate exit status fairly easily.) However, you may be better off doing if test ! -f foo or something like that; unfortunately, "test" doesn't have a predicate for "just test whether it exists", but you may really want a more restrictive predicate anyway. -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)