From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26406 invoked from network); 3 May 1998 01:41:28 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 3 May 1998 01:41:28 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id VAA04337; Sat, 2 May 1998 21:38:26 -0400 (EDT) Resent-Date: Sat, 2 May 1998 21:38:16 -0400 (EDT) Message-Id: <199805030138.VAA26176@luomat.peak.org> Content-Type: text/plain MIME-Version: 1.0 In-Reply-To: <199805022224.QAA03113@ipecac.Central.Sun.COM> From: Timothy J Luoma Date: Sat, 2 May 98 21:38:27 -0400 To: talley@boulder.Central.Sun.COM (Steve Talley) Subject: Re: exit value of intermediate program in pipe cc: zsh-users@math.gatech.edu References: <199805022224.QAA03113@ipecac.Central.Sun.COM> Resent-Message-ID: <"o2MKA.0.131.7gyIr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1498 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Author: talley@boulder.Central.Sun.COM (Steve Talley) Original-Date: Sat, 2 May 1998 16:24:40 -0600 Message-ID: <199805022224.QAA03113@ipecac.Central.Sun.COM> > foo () { > /bin/blah | grep -v "foo" > } > > I would like this function to exit with the exit value from the > /bin/blah process, but it exits with the exit value from grep instead. > > Is there any way to do this? Do you ming a tempfile ? foo () { tmp=/tmp/$0.$USER.$$ /bin/blah > $tmp 2>&1 exit="$?" grep -v foo $tmp && /bin/rm -f $tmp exit $exit } You don't have to use /tmp as the tempdir if you have security concerns.. $HOME would work just as well. TjL ps -- if you use this function in your shell, doesn't it kill the shell ?