zsh-users
 help / color / mirror / code / Atom feed
* Re: pipe on stderr
  1999-07-15 16:23 pipe on stderr Didier Verna
@ 1999-07-15 16:08 ` Peter Stephenson
  1999-07-16  4:11   ` Geoff Wing
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 1999-07-15 16:08 UTC (permalink / raw)
  To: zsh-users

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@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


^ permalink raw reply	[flat|nested] 3+ messages in thread

* pipe on stderr
@ 1999-07-15 16:23 Didier Verna
  1999-07-15 16:08 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Didier Verna @ 1999-07-15 16:23 UTC (permalink / raw)
  To: zsh-users


                Hi!

        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' ?

-- 
    /     /   _   _       Didier Verna        http://www.inf.enst.fr/~verna/
 - / / - / / /_/ /     ENST, INFRES C201.1       mailto:verna@inf.enst.fr
/_/ / /_/ / /__ /        46 rue Barrault        Tel.   +33 (1) 45 81 73 46
                       75013 Paris, France      Fax.   +33 (1) 45 81 31 19


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pipe on stderr
  1999-07-15 16:08 ` Peter Stephenson
@ 1999-07-16  4:11   ` Geoff Wing
  0 siblings, 0 replies; 3+ messages in thread
From: Geoff Wing @ 1999-07-16  4:11 UTC (permalink / raw)
  To: zsh-users

Peter Stephenson <pws@ibmth.df.unipi.it> typed:
: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' ?

Simple way?  Sort of.

% foo 2>>(bar)         # same as   foo 2> >(bar)

Regards,
-- 
Geoff Wing : <gcw@pobox.com>     Work URL: http://www.primenet.com.au/
Rxvt Stuff : <gcw@rxvt.org>      Ego URL : http://pobox.com/~gcw/
Zsh Stuff  : <gcw@zsh.org>       Phone   : (Australia) 0413 431 874


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-07-16  4:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-15 16:23 pipe on stderr Didier Verna
1999-07-15 16:08 ` Peter Stephenson
1999-07-16  4:11   ` Geoff Wing

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).