Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!brl-adm!brl-smoke!smoke!swa@COMET.LCS.MIT.EDU From: swa@COMET.LCS.MIT.EDU (Steven Augart) Newsgroups: net.unix-wizards Subject: question-- Bourne (and C) SHELL Message-ID: <3220@brl-smoke.ARPA> Date: Thu, 21-Aug-86 16:47:20 EDT Article-I.D.: brl-smok.3220 Posted: Thu Aug 21 16:47:20 1986 Date-Received: Fri, 22-Aug-86 09:36:57 EDT Sender: news@brl-smoke.ARPA Lines: 38 From: Arturo Perez Date: 14 Aug 86 14:12:45 GMT In the csh you can do something like ls foo if (! $status) then echo "foo exists" endif (parenthetical note: "ls" will return status 0 whether or not it can find foo. The example is faulty). The key thing here is the ability to NOT the value of status. How is this similar thing done in Bourne shell. Can't be done directly in the Bourne shell, since the Bourne shell simply doesn't have C-shell style expressions; they are handled separately by the "test" and "expr" programs. Since the bourne shell doesn't have expressions, it also doesn't have an internal NOT operator. However, you can do this simple workaround (or you could if "ls foo" returned 0 status to indicate that it found "foo" and nonzero status to indicate that it hadn't found "foo"): if ls foo then ; else echo "foo not found" endif Steven Augart MIT Laboratory for Computer Science swa@xx.lcs.mit.edu, swa@xx.ARPA