retval of pipelined cmd in bash

Randall R Schulz rrschulz@cris.com
Fri Dec 20 20:42:00 GMT 2002


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@webdev]:{509}:% gcc rt.c -o rt
>   [root@webdev]:{510}:% ./rt
>   [root@webdev]:{511}:% echo $?
>   21
>   [root@webdev]:{512}:%
>
>Elfyn
>elfyn@exposure.org.uk
>
>
>--- Soren A <soren_andersen@fastmail.fm> 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/



More information about the Cygwin mailing list