Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Redirect a specific file descriptor to a pipe?

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.


Messages sorted by: Reverse Date, Date, Thread, Author