Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: net.unix Subject: Re: question-- Bourne (and C) SHELL Message-ID: <3082@brl-smoke.ARPA> Date: Fri, 15-Aug-86 17:29:09 EDT Article-I.D.: brl-smok.3082 Posted: Fri Aug 15 17:29:09 1986 Date-Received: Tue, 19-Aug-86 03:31:08 EDT References: <1751@ittatc.ATC.ITT.UUCP> <7028@utzoo.UUCP> <150@humming.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 24 In article <150@humming.UUCP> arturo@humming.UUCP (Arturo Perez) writes: >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 :-)? Here is how the .funcs function-definition file I source from my .profile does it: not(){ $* if [ $? -eq 0 ] then return 1 else return 0 fi } So I can then use this new "not" command as in: if not stuff ... then whatever fi Another more direct trick is: if stuff ... then : else whatever fi