From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10200 invoked from network); 15 Dec 2004 19:00:33 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Dec 2004 19:00:33 -0000 Received: (qmail 73589 invoked from network); 15 Dec 2004 19:00:27 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Dec 2004 19:00:27 -0000 Received: (qmail 20349 invoked by alias); 15 Dec 2004 18:59:28 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8299 Received: (qmail 20331 invoked from network); 15 Dec 2004 18:59:28 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Dec 2004 18:59:28 -0000 Received: (qmail 71936 invoked from network); 15 Dec 2004 18:59:28 -0000 Received: from mailns.chase.com (HELO sd8.jpmchase.com) (170.148.93.205) by a.mx.sunsite.dk with SMTP; 15 Dec 2004 18:59:27 -0000 Received: from mmx6.jpmchase.com (mmx6 [10.21.212.139]) by sd8.jpmchase.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id iBFIxOkm004899 for ; Wed, 15 Dec 2004 13:59:25 -0500 Received: from bretton.ny.jpmorgan.com (bretton.ny.jpmorgan.com [10.21.19.32]) by mmx6.jpmchase.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id iBFIxKjE023223 for ; Wed, 15 Dec 2004 13:59:20 -0500 Received: from aheading by bretton.ny.jpmorgan.com with local (Exim 4.41) id 1CeeMq-0006Va-AQ for zsh-users@sunsite.dk; Wed, 15 Dec 2004 13:59:20 -0500 Date: Wed, 15 Dec 2004 13:59:20 -0500 From: Anthony Heading To: zsh-users@sunsite.dk Subject: exec | wc isn't very useful... Message-ID: <20041215185920.GA24992@bretton.ny.jpmorgan.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 Hi, Can anyone tell me why this doesn't do what I'd hope: exec | wc I'm wondering how to redirect the shell's "default" stdout into a process, e.g. do the equivalent of perl's open(STDOUT, "| wc"); print "two words"; Obviously one can do "echo two words | wc", or "wc <(echo two words)" or whatever, but that doesn't seem to lend itself too well to conditional redirection, viz: case $out in script) exec > script.out ;; gnuplot) exec | gnuplot ;; # doesn't work - hmm stdout) ;; esac Equivalently, a sometimes appealing alternative to: ( echo foo echo bar ) > xyzzy.txt is exec > xyzzy.txt echo foo echo bar but this doesn't seem to work for pipelines. Except that perl can do it no trouble... Pointers to anything I'm missing very welcome... Rgds Anthony This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates