🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix
Article #321

Re: Nasty little shell syntax problem for a Wizard

#321
From: Jan Newmarch
Date: Wed, 21 Nov 1990 00:03
25 lines
1383 bytes
>Conceptually what I want is something like:
>gcc <parms> 2>&1 | egrep -v "<re>" || (abort_script;exit 1)
>Except that I want the || to use the condition code from the gcc (NOT the egrep)
>AND I want the condition code of the whole expression to be OK if the compile
>is OK or ERROR if the compile has an error.

The shell variable `?' holds the exit code of the last instruction executed,
so you could run your gcc, save the exit code, run egrep and the exit:

	gcc > ...
  	code=$?
	egrep ...
	exit $code

+----------------------+---+
  Jan Newmarch, Information Science and Engineering,
  University of Canberra, PO Box 1, Belconnen, Act 2616
  Australia. Tel: (Aust) 6-2522422. Fax: (Aust) 6-2522999

  ACSnet: jan@ise.canberra.edu.au
  ARPA:   jan%ise.canberra.edu.au@uunet.uu.net
  UUCP:   {uunet,ukc}!munnari!ise.canberra.edu.au!jan
  JANET:  jan%au.edu.canberra.ise@EAN-RELAY

+--------------------------+
Technical Details
Message-ID: <2269@megadon.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!olivea!apple!altos!megadon!clp
References: <2258@megadon.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!olivea!apple!altos!megadon!clp
From: jan@golf.canberra.edu.au (Jan Newmarch)
Newsgroups: comp.unix
Subject: Re: Nasty little shell syntax problem for a Wizard
Message-ID: <2269@megadon.UUCP>
Date: 21 Nov 90 00:03:20 GMT
References: <2258@megadon.UUCP>
Sender: clp@megadon.UUCP
Organization: Info Sci & Eng, University of Canberra
Lines: 25
Approved: clp@megadon.UUCP
Apparently-To: comp-unix@uunet.uu.net