From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7315 invoked from network); 19 Apr 2001 05:11:19 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 19 Apr 2001 05:11:19 -0000 Received: (qmail 27351 invoked by alias); 19 Apr 2001 05:10:41 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3825 Received: (qmail 27332 invoked from network); 19 Apr 2001 05:10:40 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer goliath.siemens.de) Date: Thu, 19 Apr 2001 09:10:36 +0400 (MSD) From: Andrej Borsenkow X-X-Sender: To: Andre Pang cc: zsh-users Subject: Re: { foo=bar; command; } | othercommand; echo $foo == no output? In-Reply-To: <20010419133634.A5425@exodus> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 19 Apr 2001, Andre Pang wrote: > I have a problem, I want to tee and still get the return code: > > prog x y z | tee > echo $? > In recent enough zsh (4.0.1-pre-3 is the latest version) you can use $pipestatus: pipestatus An array containing the exit values returned by all commands in the last pipeline. bor@itsrm2:~%> cat /foo/bar | tee cat: Cannot open /foo/bar: No such file or directory bor@itsrm2:~%> print $pipestatus 2 0 -andrej