From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11660 invoked from network); 9 Jul 2003 04:52:33 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 9 Jul 2003 04:52:33 -0000 Received: (qmail 14858 invoked by alias); 9 Jul 2003 04:52:23 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6392 Received: (qmail 14844 invoked from network); 9 Jul 2003 04:52:23 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 9 Jul 2003 04:52:23 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [207.172.4.62] by sunsite.dk (MessageWall 1.0.8) with SMTP; 9 Jul 2003 4:52:18 -0000 Received: from 65-78-17-226.c3-0.nwt-ubr2.sbo-nwt.ma.cable.rcn.com ([65.78.17.226] helo=zion.rcn.com) by smtp03.mrf.mail.rcn.net with esmtp (Exim 3.35 #4) id 19a6wA-0004wV-00; Wed, 09 Jul 2003 00:52:14 -0400 Received: by zion.rcn.com (Postfix, from userid 501) id 0F81B1C026; Wed, 9 Jul 2003 00:48:28 -0400 (EDT) To: Bart Schaefer Cc: Zsh users Subject: Re: Another expansion (substitution?) question References: <545d6gkyk8e.fsf@icd.teradyne.com> <1030709044244.ZM21535@candle.brasslantern.com> From: Vin Shelton Organization: EtherSoft, Inc Date: Wed, 09 Jul 2003 00:48:27 -0400 In-Reply-To: <1030709044244.ZM21535@candle.brasslantern.com> (Bart Schaefer's message of "Wed, 9 Jul 2003 04:42:44 +0000") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Bart Schaefer writes: > On Jul 8, 1:57pm, Vin Shelton wrote: > } Subject: Another expansion (substitution?) question > } > } print -l ${(ou)${^$(all_dirs)}/$=~^*(N/:t)} > } zsh: bad pattern: emacs* o*(N > > There are three problems here. One, you can't use an expansion that > does not have braces (in this case "$=~^*") nested inside an expansion > that does have braces. So you'd at least have to write (the following > is not a working substitution): > > ${(ou)${^$(all_dirs)}/${=~^*}(N/:t)} > > However, problem two, globbing is not applied inside a nested expansion > so your "(N/:t)" qualifiers are useless; and problem three, a slash in > a brace-expansion is (as you found) a pattern substitution operator, as > is two slashes, which is why doubling it didn't work; and three slashes > in a row is probably being interpreted as substituting the empty string > for all occurrences of the empty string. > > } x=( ${^$(all_dirs)}/$=~^*(N/:t) ) > } print -l ${(ou)x} > > The only way to reduce that to a one-liner is to use another subshell > like so: > > print -l ${(ouf)"$(print -l ${^$(all_dirs)}/$=~^*(N/:t))"} > > This is probably not worth the expense of the extra fork and I/O. Stick > with the two-liner using the temporary. Thanks for the explanation, Bart. - Vin