Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Slightly OT: Error-Handling in a Pipeline, preferably non-zsh



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@xxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author