From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5938 invoked by alias); 11 Mar 2017 00:17:37 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22557 Received: (qmail 25195 invoked from network); 11 Mar 2017 00:17:37 -0000 X-Qmail-Scanner-Diagnostics: from mail-qt0-f182.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.216.182):SA:0(-0.7/5.0):. Processed in 1.198822 secs); 11 Mar 2017 00:17:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.216.182 as permitted sender) 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wBT0KxQ5UzniFKYDOucwS0SbdK3pcZH8AU+qymWEvew=; b=g8GW+byh8On5AqgcTwrBD4VOPpFqMCPGv79on3R4iwoRR3xqjNZ+eiR0ucP2p1FNyW Vh4ix8d/ru5tsVyWga7ENdeKpWZM91jSMlWRpmhhOw39hrl5yoSYoRQIeWBXiDPee6FT 7HoqUP3m3buKv/xLrO+6UcfhM2PjrqKbGae9iXvidytEdqELU4mLruwIlVc8ORG+XLPU FnXo0lTxor+EQQmdKsR2t7owGZn5s826hUyRmB0oXVZqBpF5833FB+7xVf8FY/2bhsFr Xx1C2WxfQoGmTTFMibk0H8QqNu2GxyW20dgdK1BGQTG12PPxAzG5ePqaA7jgj6kQa1R0 ctJg== X-Gm-Message-State: AMke39ndZF+ZA+FQlUbKc0/NEGQxPhy2STlwO+3MiPmqTVAfScKhzEi+1nt7S/y4KbrfWUvY9O5Jkncx7ZS6cA== X-Received: by 10.200.37.89 with SMTP id 25mr24242066qtn.4.1489191450514; Fri, 10 Mar 2017 16:17:30 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <170309180417.ZM14034__34042.4779606566$1489111700$gmane$org@torch.brasslantern.com> <20170310172219.GA4206@chaz.gmail.com> <170310105112.ZM843@torch.brasslantern.com> From: Mikael Magnusson Date: Sat, 11 Mar 2017 01:17:29 +0100 Message-ID: Subject: Re: Redirect a specific file descriptor to a pipe? To: Nathan Dorfman Cc: Bart Schaefer , Zsh Users Content-Type: text/plain; charset=UTF-8 On Sat, Mar 11, 2017 at 12:32 AM, Nathan Dorfman wrote: > On Fri, Mar 10, 2017 at 11:51 AM, Bart Schaefer > 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