Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: pipe on stderr
- X-seq: zsh-users 2442
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: Re: pipe on stderr
- Date: Thu, 15 Jul 1999 18:08:45 +0200
- In-reply-to: "Didier Verna"'s message of "15 Jul 1999 18:23:29 DFT." <qyjg12pnapq.fsf@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
Didier Verna wrote:
> I've only recently discovered that there's no simple way, in any
> shell, to pipe stderr on another process. As you can write `foo 2> foo.err',
> wouldn't it be nice to be able to write `foo 2| bar' ?
Trouble is, it gets into quite serious trouble with existing syntax, since
you don't need a space before the pipe --- think about
echo 2| foo
so although it could be an option there's probably still too much scope for
confusion.
As you may already have discovered, you can swap file descriptors:
echo foo 3>&1 1>&2 2>&3 | sed 's/foo/bar/'
which has the effect you want provided 1 and 2 were originally going to the
same place, i.e. what used to be 1 still goes there but what used to be 2
now goes to the pipe. But agree it's not simple (and in zsh you have to
`unsetopt multios').
--
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
Messages sorted by:
Reverse Date,
Date,
Thread,
Author