From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26580 invoked from network); 12 Aug 2005 02:27:27 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 Aug 2005 02:27:27 -0000 Received: (qmail 50277 invoked from network); 12 Aug 2005 02:27:21 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Aug 2005 02:27:21 -0000 Received: (qmail 5253 invoked by alias); 12 Aug 2005 02:27:08 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9301 Received: (qmail 5244 invoked from network); 12 Aug 2005 02:27:08 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 Aug 2005 02:27:08 -0000 Received: (qmail 48871 invoked from network); 12 Aug 2005 02:27:08 -0000 Received: from vms040pub.verizon.net (206.46.252.40) by a.mx.sunsite.dk with SMTP; 12 Aug 2005 02:27:04 -0000 Received: from candle.brasslantern.com ([71.116.79.190]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IL3009ID851DJE1@vms040.mailsrvcs.net> for zsh-users@sunsite.dk; Thu, 11 Aug 2005 21:27:03 -0500 (CDT) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j7C2R0de012611 for ; Thu, 11 Aug 2005 19:27:01 -0700 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j7C2R0ph012610 for zsh-users@sunsite.dk; Thu, 11 Aug 2005 19:27:00 -0700 Date: Fri, 12 Aug 2005 02:27:00 +0000 From: Bart Schaefer Subject: Re: Printing arrays for use with $() In-reply-to: <20050811170124.GA8279@DervishD> In-reply-to: <20050811222847.GA341@DervishD> To: Zsh Users Message-id: <1050812022700.ZM12607@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: quoted-printable References: <20050811161654.GA8200@DervishD> <1050811163714.ZM2498@candle.brasslantern.com> <20050811170124.GA8279@DervishD> <20050811222847.GA341@DervishD> Comments: In reply to DervishD "Re: Printing arrays for use with $()" (Aug 11, 7:01pm) Comments: In reply to DervishD "Re: Printing arrays for use with $()" (Aug 12, 12:28am) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 On Aug 11, 7:01pm, DervishD wrote: } } Hi Bart :) "Hi, Ra=FAl!" } Impossible for most commands. Hence the short answer ... } So, if I must pass a list of filenames from one app to another in } the most generic way, which are my options? It all comes back to having some degree of control over the calling environment. For example, if it were sufficient that du -s *.whatever and eval du -s `myscript` were equivalent, then print -r -- ${(q)array} should be enough. On Aug 12, 12:28am, DervishD wrote: } Subject: Re: Printing arrays for use with $() } } I've been trying this (without success): } = } command $(printf '"%s "' $array) = Even if that would work (which, as you've seen, it does not) why would you want to include a trailing space *inside* the double quotes? } The worst thing is that I had the intention of using a couple } more scripts in this way, generating a list of files to work on and } dumping it to stdout :( but without being able to solve this } problem... Well, you could always change tack entirely and instead of du -s `myscript` you could call myscript du -s That is, have your script work the way zargs does. Or you could modify zargs to use ${(z)...} on its list of files, and then run qzargs -- `myscript` -- du -s But again all of this assumes you can control the caller, which means you could just as easily require IFS=3D$'\0'. There's just no way around= this, given the semantics of $(...) and word splitting.