From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13015 invoked from network); 15 May 2006 15:17:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 May 2006 15:17:48 -0000 Received: (qmail 19194 invoked from network); 15 May 2006 15:17:37 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 May 2006 15:17:37 -0000 Received: (qmail 12904 invoked by alias); 15 May 2006 15:17:28 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10266 Received: (qmail 12886 invoked from network); 15 May 2006 15:17:27 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 May 2006 15:17:27 -0000 Received: (qmail 17966 invoked from network); 15 May 2006 15:17:27 -0000 Received: from aw.gs (HELO dynamite.narpes.com) (213.250.81.161) by a.mx.sunsite.dk with SMTP; 15 May 2006 15:17:26 -0000 Received: from localhost ([127.0.0.1]) by dynamite.narpes.com with esmtp (Exim 4.43) id 1Ffeoz-000Go5-Ca for zsh-users@sunsite.dk; Mon, 15 May 2006 15:17:21 +0000 Date: Mon, 15 May 2006 15:17:21 +0000 (GMT) From: "A. Wik" cc: Zsh users Subject: Re: Quoting =(command) In-Reply-To: <200603261837.k2QIbOow004386@pwslaptop.csr.com> Message-ID: <20060326193417.C67912@dynamite.narpes.com> References: <200603261837.k2QIbOow004386@pwslaptop.csr.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII (Look, it's not even a month old ;) On Sun, 26 Mar 2006, Peter Stephenson wrote: > [This is probably more in the line of zsh-users.] I'm inclined to agree - however, not considering the point of view of posting at the time of reading the subscription instructions, I interpreted them as "just forget zsh-users and join zsh-workers for the full range of content"... (but I'll try it now.) > "A. Wik" wrote: > > > > How do I quote the =() syntax that returns a the > > name of a temporary file containing the output of ? > > > > Example: star is an improved tar program that can take a list of > > files to archive through the = command-line parameter - in > > this case, the list is to be generated by the find program: > > # star -cv f=etc-bak.tar -C / list==(cd / ; find ./etc -newer /tmp/mtime. > > ref) > > zsh: parse error near `)' > > Do you mean star takes a *file containing* the list of files to archive? > If it was just the list itself, then you would use "$(...)". Yes, I did mean the former - the argument of "list=" is always a file name... or as I discovered later, a dash (-) for reading from stdin, and which was, of course, the perfect solution to my problem. Although the lone dash is interpreted similary by many other programs too, a solution internal to the shell is certain to come in handy some day... and Bart's second reply suggests a workaround about as concise as can reasonably be expected: star -cv f=bak.tar list=${:-=(commands...)} Perhaps it should be mentioned or at least hinted at in the context of the =() construct, as that was where I started looking. Considering that even you as the lead developer managed to miss it, the odds may not be in favour of the casual explorer doing so... but at least hindsight seems to help: ${name:-word} If name is set and is non-null then substitute its value; otherwise substitute word. If name is missing, substitute word. -aw