Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Saving error return code in a pipeline
- X-seq: zsh-users 9001
- From: dom@xxxxxxxxxxxxxxxx (Dominic Mitchell)
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: Saving error return code in a pipeline
- Date: Thu, 30 Jun 2005 10:36:32 +0100
- In-reply-to: <20050630093307.GA23323@DervishD>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20050630093307.GA23323@DervishD>
On Thu, Jun 30, 2005 at 11:33:07AM +0200, DervishD wrote:
> Hi all :)
>
> Maybe I'm asking for something impossible, or maybe I'm just dumb
> enough to not see the obvious solution...
>
> I have a script which returns an error code, but it outputs a lot
> of info, so I call it like this:
>
> script.install |& tee install.log
>
> Obviously this 'masks' the return code, but I want to see the
> output even though I'm saving it to a file, so a redirection doesn't
> fit me well. I can use MULTIOS, of course, but I don't want to use it
> for all my commands...
>
> Is there any better solution than this?:
>
> script.install >(tee install.log) 2>&1
Try looking at the pipestatus array. It contains all the exit codes
from the last pipeline. So you should be able to get the code you want
by examining $pipestatus[1].
-Dom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author