This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: retval of pipelined cmd in bash
- From: Randall R Schulz <rrschulz at cris dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 20 Dec 2002 20:14:50 -0800
- Subject: Re: retval of pipelined cmd in bash
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/