zsh-users
 help / color / mirror / code / Atom feed
From: Dan Nelson <dnelson@allantgroup.com>
To: ZSH User List <zsh-users@sunsite.dk>
Subject: Re: how to pipe to stdout and stderr
Date: Wed, 17 Dec 2003 20:13:00 -0600	[thread overview]
Message-ID: <20031218021259.GE81800@dan.emsphone.com> (raw)
In-Reply-To: <20031218001201.GA27866@spiegl.de>

In the last episode (Dec 18), Andy Spiegl said:
> Maybe I'm just too tired right now, but I can't find the solution how to
> pipe the standard output and standard error to 2 different programs.
> 
> Example:
>  program foo   (prints to stdout and stderr)
>   program bar1 should receive only stdout
>   program bar2 should receive only stderr
> 
> How can I do this?  Someone knows how to do that in bash, too?

It's a little tricky since regular pipes are linear.  Zsh does let you
redirect to commands though:

% ( echo stdout ; echo 1>&2 stderr ) > >(tr a-z A-Z) 2> >(tr a-z b-za)
tuefss
STDOUT
%

See the zsh manpage, under the heading "PROCESS SUBSTITUTION".

-- 
	Dan Nelson
	dnelson@allantgroup.com


  parent reply	other threads:[~2003-12-18  2:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-18  0:12 Andy Spiegl
2003-12-18  1:44 ` Ibraheem Umaru-Mohammed
2003-12-18  2:01   ` Andy Spiegl
2003-12-18  2:17     ` Hisham Muhammad
2003-12-18  9:59     ` Ibraheem Umaru-Mohammed
2003-12-18  2:13 ` Dan Nelson [this message]
2003-12-18 10:17   ` Andy Spiegl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031218021259.GE81800@dan.emsphone.com \
    --to=dnelson@allantgroup.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).