Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!oliveb!mipos3!omepd!merlyn From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.questions Subject: Re: How do I ask "if NOT" in shell? Message-ID: <5096@omepd.UUCP> Date: 23 Oct 89 20:18:58 GMT References: <28381@shemp.CS.UCLA.EDU> Sender: news@omepd.UUCP Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Hillsboro, Oregon, USA Lines: 30 In-reply-to: kirkaas@oahu.cs.ucla.edu (paul kirkaas) In article <28381@shemp.CS.UCLA.EDU>, kirkaas@oahu (paul kirkaas) writes: | How can one say "if not" in a shellscript; that is, execute the body of | the "then" only if the argument of "if" returns a non-zero exit status? | | I would like something like: | | if ! TESTCOMMAND | then | BODY | fi | | Stupid question? Trivial answer? I hope so. Thanks. Yeah. if TESTCOMMAND then : nada else BODY fi Easy. Just another Bourne-again hacker, -- /== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\ | on contract to Intel's iWarp project, Hillsboro, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn | \== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/