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

Re: Redirect a specific file descriptor to a pipe?



On Fri, Mar 10, 2017 at 11:51 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> } In zsh, to avoid the multios effect, you can do:
> }
> } {strace -o /dev/fd/3 ./a.out 3>&1 > out.log 2> err.log} | less
> }
> } or disable multios (set +o multios).
>
> With multios and without the braces, out.log gets the a.out output
> and less gets both the strace output and the a.out output, which is
> actually what I meant to do (but might not be exactly what Nathan
> wanted, in retrospect).  Thanks for the correction.

Thanks guys, this does actually answer my question, and makes sense
now that I think about.

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. Perhaps we
can't redirect stdout because it's a curses program that needs direct
terminal access, but we want to do something like this:

strace -o /dev/fd/3 mutt 3>XXX

Where instead of XXX, we want to send fd 3 to |xz or |ssh?

Feel free to ignore me if you think I'm going off the deep end :)

-nd.



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