From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19959 invoked by alias); 13 Mar 2017 17:46:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40841 Received: (qmail 18289 invoked from network); 13 Mar 2017 17:46:05 -0000 X-Qmail-Scanner-Diagnostics: from 195.159.176.226 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(195.159.176.226):SA:0(2.7/5.0):. Processed in 2.318522 secs); 13 Mar 2017 17:46:05 -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=2.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NML_ADSP_CUSTOM_MED,RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: gcszd-zsh-workers@m.gmane.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at m.gmane.org does not designate permitted sender hosts) X-Injected-Via-Gmane: http://gmane.org/ To: zsh-workers@zsh.org From: Stephane Chazelas Subject: Re: Redirect a specific file descriptor to a pipe? Date: Mon, 13 Mar 2017 17:26:56 +0000 Message-ID: <20170313172656.GA22570@chaz.gmail.com> References: <170309180417.ZM14034__34042.4779606566$1489111700$gmane$org@torch.brasslantern.com> <20170310172219.GA4206@chaz.gmail.com> <170310105112.ZM843@torch.brasslantern.com> <170310182430.ZM17517__8964.51098747111$1489199135$gmane$org@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mutt/1.5.24 (2015-08-30) Content-Disposition: inline In-Reply-To: <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