Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Piping stderr (was Re: Two bug reports)
- X-seq: zsh-workers 16889
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Piping stderr (was Re: Two bug reports)
- Date: Sun, 24 Mar 2002 01:01:04 -0800 (PST)
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- In-reply-to: <1020323224514.ZM29171@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
On Sat, 23 Mar 2002, Bart Schaefer wrote:
> On Mar 23, 1:18pm, Wayne Davison wrote:
> } I'm wondering if it would be nice to create a syntax for piping just
> } stderr?
>
> You mean, other than `2>>(...)'?
Uh ... Yeah, Yeah. That's what I meant. _Other_ than that. :-)
(I had apparently neglected to find that syntax when I was searching
the zsh man page.)
So, I suppose that Peter's reply to David Hughes could be ammended to
say that in addition to turning off multios, he could change this
command:
/bin/sh -c 'echo out; echo err >&2' 2>&1 >/dev/null | cat
into this one:
/bin/sh -c 'echo out; echo err >&2' >/dev/null 2>>(cat)
The bad thing about this idiom is that it doesn't wait for "cat" to
finish before moving on. If we implemented my proposed stderr-pipe
syntax, the following command wouldn't have that problem:
/bin/sh -c 'echo out; echo err >&2' >/dev/null 2>|& cat
> Hmm. `|&' is short for `2>&1 |'. What would the new syntax be short
> for?
It wouldn't be short for anything. Instead "|" would become short for
"1>|&". The construct simply means "take the numbered file handle and
pipe it to stdin of the following command."
> The problem being that in order to pipe "just stderr" you have
> to dispose of stdout somehow.
No, stdout doesn't need to be affected at all. If the user wants stdout
to go somewhere other than the default, it can be redirected explicitly
(as I did above).
..wayne..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author