From owner-freebsd-questions Tue Apr 29 04:47:00 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id EAA11681 for questions-outgoing; Tue, 29 Apr 1997 04:47:00 -0700 (PDT) Received: from iceberg.anchorage.net. (root@iceberg.anchorage.net [207.14.72.150]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id EAA11673 for ; Tue, 29 Apr 1997 04:46:57 -0700 (PDT) Received: from aak.anchorage.net (ai-131 [207.14.72.131]) by iceberg.anchorage.net. (8.6.11/8.7.3) with SMTP id CAA13042 for ; Tue, 29 Apr 1997 02:44:03 -0800 Date: Tue, 29 Apr 1997 03:37:41 -0800 (AKDT) From: Steve Howe X-Sender: abc@aak.anchorage.net To: freebsd-questions Subject: sh - lists, pipes & exits Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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