Path: 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 >Conceptually what I want is something like: >gcc 2>&1 | egrep -v "" || (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 +--------------------------+