Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Redirect a specific file descriptor to a pipe?
- X-seq: zsh-workers 40841
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Redirect a specific file descriptor to a pipe?
- Date: Mon, 13 Mar 2017 17:26:56 +0000
- In-reply-to: <170310182430.ZM17517__8964.51098747111$1489199135$gmane$org@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CADgEyUsOZZZhiJM5JQrdHORt-ehoLJtYmwW8po4=LViuydMFiw@mail.gmail.com> <170309180417.ZM14034__34042.4779606566$1489111700$gmane$org@torch.brasslantern.com> <20170310172219.GA4206@chaz.gmail.com> <170310105112.ZM843@torch.brasslantern.com> <CADgEyUu9Ds5kNMA-uLa0Fo4KHw6AKfC4r3dDqBJ--4rcPU9Lvw@mail.gmail.com> <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author