Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: { foo=bar; command; } | othercommand; echo $foo == no output?
- X-seq: zsh-users 3825
- From: Andrej Borsenkow <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: Andre Pang <ozone@xxxxxxxxxxxxxxxx>
- Subject: Re: { foo=bar; command; } | othercommand; echo $foo == no output?
- Date: Thu, 19 Apr 2001 09:10:36 +0400 (MSD)
- Cc: zsh-users <zsh-users@xxxxxxxxxxxxxx>
- In-reply-to: <20010419133634.A5425@exodus>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
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 <S> <Z>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author