zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: Redirect a specific file descriptor to a pipe?
Date: Mon, 13 Mar 2017 17:26:56 +0000	[thread overview]
Message-ID: <20170313172656.GA22570@chaz.gmail.com> (raw)
In-Reply-To: <170310182430.ZM17517__8964.51098747111$1489199135$gmane$org@torch.brasslantern.com>

2017-03-10 18:24:30 -0800, Bart Schaefer:
> On Mar 10,  4:32pm, Nathan Dorfman wrote:
> }
> } I still think it might be useful to be able to pipe any fd, not just
> } stdout, but I don't know if I can contrive a great example.
> 
> It depends on what your intentions are.  The definition of a pipeline
> in shell syntax is that the standard output of the left side connects
> to the standard input of the right side.  So if you want to use a pipe,
> you have to make the right thing *be* stdout, regardless of which other
> descriptor it might have started out to be.
[...]

For information, the rc shell allows piping any fd, not just
stdout on the left command to stdin of the right command.

cmd1 |[3=4] cmd2

Would make a pipe in between fd 3 of cmd1 and fd 4 of cmd2


yash has a pipeline redirection operator (shaped like ksh's
process substitution operator).

cmd1 3>(cmd2)

Runs cmd1 with fd 3 to a pipe to fd 0 of cmd2.

yash doesn't wait for cmd2 there though.

-- 
Stephane


           reply	other threads:[~2017-03-13 17:46 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <170310182430.ZM17517__8964.51098747111$1489199135$gmane$org@torch.brasslantern.com>]

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=20170313172656.GA22570@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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).