Date: Tue, 29 Apr 1997 03:37:41 -0800 (AKDT) From: Steve Howe <un_x@anchorage.net> To: freebsd-questions <questions@freebsd.org> Subject: sh - lists, pipes & exits Message-ID: <Pine.BSF.3.95q.970429032611.8526A-100000@aak.anchorage.net>
next in thread | raw e-mail | index | archive | help
how can i return an exit value (to the invokers shell) of a command in a list which gets piped into "more" ... { gcc 2>&1 see.c; xit=$?; if [ $xit ]; then exit $xit; fi; } | more ------------------------------------------------------------------------- of course, "xit" ends up getting "wiped", and more is executed regardless. i can't figure out how to do this without executing gcc 2x ... such as follows ... ------------------------------------------------------------------------- gcc 1>&- 2>&- see.c; xit=$? if [ $xit != 0 ]; then blah; blah; exit $xit else gcc 2>&1 see.c | more fi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.970429032611.8526A-100000>