Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-Id: <5.2.0.9.2.20021220201302.02a8c9f0@pop3.cris.com> X-Sender: rrschulz AT pop3 DOT cris DOT com Date: Fri, 20 Dec 2002 20:14:50 -0800 To: cygwin AT cygwin DOT com From: Randall R Schulz Subject: Re: retval of pipelined cmd in bash In-Reply-To: <20021220225142.241934979@sitemail.everyone.net> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id gBL4Eq219916 Elfyn, If you looker more closely, you'll see that Sören already knows about the $? variable. Randall Schulz At 14:51 2002-12-20, Elfyn McBratney wrote: >Hello Soren, > >What you need is the $? variable. The simplest testcase would be this: > > >>> rt.c >int >main() >{ > return(21); >} ><<< > > [root AT webdev]:{509}:% gcc rt.c -o rt > [root AT webdev]:{510}:% ./rt > [root AT webdev]:{511}:% echo $? > 21 > [root AT webdev]:{512}:% > >Elfyn >elfyn AT exposure DOT org DOT uk > > >--- Soren A wrote: > >Hallo Cygwains, > > > >... > >----------------------------------8<----------------------------------- > > function powermake > > { > > declare -x LESS='-z-2$ -s~wR' > > declare PAGER='/bin/less' > > declare +x ECODE= > > { make "$@" || ECODE=$? ; } 2>&1 | tee $MAKE_ERR_TO | \ > > /cdv/f/scr/colormake.pl | $PAGER -O"${MAKE_ERR_TO}.colorlog" > > if [[ $ECODE ]] # "0" and "1" are both TRUE; "null" is FALSE. > > then $gvimexe --servername 'QUICKFIX' -q "$(cygpath -wla > $MAKE_ERR_TO)" > > else echo 'No "make" errors to diagnose: retval was ' '"'$ECODE'".' > > fi > > return $ECODE > > } > >----------------------------------8<----------------------------------- > > > >... > > > > Thanks, > > Soren -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/