Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Redirect a specific file descriptor to a pipe?
- X-seq: zsh-users 22557
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Nathan Dorfman <ndorfman@xxxxxxxxx>
- Subject: Re: Redirect a specific file descriptor to a pipe?
- Date: Sat, 11 Mar 2017 01:17:29 +0100
- Cc: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wBT0KxQ5UzniFKYDOucwS0SbdK3pcZH8AU+qymWEvew=; b=eGWGcuiUT9NPsSHum+rpr1Kq+n4jX0QDnFH3KFcoTnyJv5iRUrIIdbrIVzTib0Vdpb 2epcJj/EN4tEnScSBKIcJvsGWaBsxv/NfSYLkgpxGzyNuDnpF8mZRsi/zMtJw4ntGcLy 8MVmdl4gcaO10nZGvKKCjfKVztyqYrUq7dgpivNC0R13xHXJyUUHajN2zI/mARkEsP5R uS7U29+9D/OfS0/tHnwlHgSW3HXOkthJfV4iXM/8ECoa5lj6CnszqIaV35NE38qUIxBZ SlP21wQzoam+8aQrD1fn84ksbByuXnputWvj5YgLJFvNHnqdk1p12R45bfSRjrd23EZx nRTw==
- In-reply-to: <CADgEyUu9Ds5kNMA-uLa0Fo4KHw6AKfC4r3dDqBJ--4rcPU9Lvw@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-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>
On Sat, Mar 11, 2017 at 12:32 AM, Nathan Dorfman <ndorfman@xxxxxxxxx> wrote:
> 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 :)
you can in theory do this
whatever_command 5> >(pipe command here) 7> >(some other pipe here)
but now that i'm testing it, it seems to not complete when it should, eg
strace -o /dev/fd/7 =true 7>&1 | cat
immediately returns but
strace -o /dev/fd/7 =true 7> >(cat)
just hangs after printing the output
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author