From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12853 invoked from network); 30 Jun 2005 09:37:09 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 30 Jun 2005 09:37:09 -0000 Received: (qmail 91919 invoked from network); 30 Jun 2005 09:37:03 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Jun 2005 09:37:03 -0000 Received: (qmail 8802 invoked by alias); 30 Jun 2005 09:36:50 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9001 Received: (qmail 8792 invoked from network); 30 Jun 2005 09:36:48 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 30 Jun 2005 09:36:48 -0000 Received: (qmail 90506 invoked from network); 30 Jun 2005 09:36:48 -0000 Received: from happygiraffe.net (81.6.215.59) by a.mx.sunsite.dk with SMTP; 30 Jun 2005 09:36:44 -0000 Received: from localhost (localhost.happygiraffe.net [127.0.0.1]) by happygiraffe.net (Postfix) with ESMTP id D2497B81B for ; Thu, 30 Jun 2005 10:36:41 +0100 (BST) Received: from happygiraffe.net ([127.0.0.1]) by localhost (ppe.happygiraffe.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 58788-14 for ; Thu, 30 Jun 2005 10:36:32 +0100 (BST) Received: by happygiraffe.net (Postfix, from userid 1001) id B93E0B86A; Thu, 30 Jun 2005 10:36:32 +0100 (BST) Date: Thu, 30 Jun 2005 10:36:32 +0100 To: Zsh Users Subject: Re: Saving error return code in a pipeline Message-ID: <20050630093632.GA60117@ppe.happygiraffe.net> References: <20050630093307.GA23323@DervishD> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050630093307.GA23323@DervishD> User-Agent: Mutt/1.5.9i From: dom@happygiraffe.net (Dominic Mitchell) X-Virus-Scanned: amavisd-new at happygiraffe.net X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 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