Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!brl-adm!brl-smoke!smoke!hahn@ames-prandtl.arpa From: hahn@ames-prandtl.arpa (Jonathan Hahn) Newsgroups: net.unix-wizards Subject: Re: question-- Bourne (and C) SHELL Message-ID: <3257@brl-smoke.ARPA> Date: Fri, 22-Aug-86 18:17:54 EDT Article-I.D.: brl-smok.3257 Posted: Fri Aug 22 18:17:54 1986 Date-Received: Sat, 23-Aug-86 05:07:55 EDT Sender: news@brl-smoke.ARPA Lines: 36 In article <150@humming.UUCP>, arturo@humming.UUCP (Arturo Perez) writes: >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 I haven't seen any mention of our Bourne shell friend "||". How about (assuming ls returns correct status): ls foo || echo foo does not exist If you want to get rid of the output and error messages from ls: ls foo > /dev/null 2>&1 || echo foo does not exist And if you want a complex second statement: ls foo || { echo foo does not exist exit } -jonathan hahn NAS Program, Ames Research Center Moffett Field, CA hahn@ames-nas