From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19039 invoked from network); 16 Aug 2004 16:11:11 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 16 Aug 2004 16:11:11 -0000 Received: (qmail 89536 invoked from network); 16 Aug 2004 16:11:05 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 16 Aug 2004 16:11:05 -0000 Received: (qmail 27256 invoked by alias); 16 Aug 2004 16:10:19 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7866 Received: (qmail 27247 invoked from network); 16 Aug 2004 16:10:19 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 16 Aug 2004 16:10:19 -0000 Received: (qmail 86184 invoked from network); 16 Aug 2004 16:08:53 -0000 Received: from dan.emsphone.com (199.67.51.101) by a.mx.sunsite.dk with SMTP; 16 Aug 2004 16:08:52 -0000 Received: (from dan@localhost) by dan.emsphone.com (8.12.11/8.12.11) id i7GG8jKL080906; Mon, 16 Aug 2004 11:08:45 -0500 (CDT) (envelope-from dan) Date: Mon, 16 Aug 2004 11:08:45 -0500 From: Dan Nelson To: Aaron Davies Cc: zsh-users@sunsite.dk Subject: Re: Slightly OT: Error-Handling in a Pipeline, preferably non-zsh Message-ID: <20040816160844.GJ73391@dan.emsphone.com> References: <95305BF6-EF81-11D8-83BE-000502631FBD@louisville.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <95305BF6-EF81-11D8-83BE-000502631FBD@louisville.edu> X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-1.5 required=6.0 tests=BAYES_01 autolearn=no version=2.63 X-Spam-Hits: -1.5 In the last episode (Aug 16), Aaron Davies said: > On Monday, August 16, 2004, at 03:51 AM, Bart Schaefer wrote: > >On Sun, 15 Aug 2004, Aaron Davies wrote: > >>On Sunday, August 15, 2004, at 11:03 PM, Philippe Troin wrote: > >> > >>>Use your first idiom and check $pipestatus[4]. > >> > >>Thanks, that seems to solve it (though it's [3], not [4]). > > > >If you have the KSH_ARRAYS option set, it's best to say so when > >asking for help on this list, or you're going to see a lot of this > >kind of "mistake." > > I'm running this under Bourne sh, as I mentioned in my original > request. (Well, technically, I think on this box it's bash, running > in sh emulation mode.) I assume this is the default array indexing > mode for sh? Bourne shell doesn't have arrays or $pipestatus, so if you really want /bin/sh compatibility, you can't use either. You'll probably have to split your pipe at the place you want to check the resultcode, and use a temp variable to store your intermediate output. -- Dan Nelson dnelson@allantgroup.com