From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18882 invoked from network); 7 Sep 2006 17:53:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 Sep 2006 17:53:41 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 9908 invoked from network); 7 Sep 2006 17:53:31 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 Sep 2006 17:53:30 -0000 Received: (qmail 16357 invoked by alias); 7 Sep 2006 17:53:23 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10689 Received: (qmail 16346 invoked from network); 7 Sep 2006 17:53:23 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 7 Sep 2006 17:53:23 -0000 Received: (qmail 8861 invoked from network); 7 Sep 2006 17:53:23 -0000 Received: from mtaout03-winn.ispmail.ntl.com (81.103.221.49) by a.mx.sunsite.dk with SMTP; 7 Sep 2006 17:53:21 -0000 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com with ESMTP id <20060907175320.EGUM1865.mtaout03-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com> for ; Thu, 7 Sep 2006 18:53:20 +0100 Received: from pwslaptop.csr.com ([81.107.41.155]) by aamtaout03-winn.ispmail.ntl.com with ESMTP id <20060907175320.VLVW11710.aamtaout03-winn.ispmail.ntl.com@pwslaptop.csr.com> for ; Thu, 7 Sep 2006 18:53:20 +0100 Received: from pwslaptop.csr.com (pwslaptop.csr.com [127.0.0.1]) by pwslaptop.csr.com (8.13.7/8.13.7) with ESMTP id k87HrE5n003319 for ; Thu, 7 Sep 2006 18:53:16 +0100 Message-Id: <200609071753.k87HrE5n003319@pwslaptop.csr.com> From: Peter Stephenson To: "zsh-users Mailinglist" Subject: Re: Solved, but now a new twist (was: Double Evaluation Question (not in FAQ)) In-Reply-To: Message from Bart Schaefer of "Mon, 04 Sep 2006 11:24:05 PDT." <060904112405.ZM9160@torch.brasslantern.com> Date: Thu, 07 Sep 2006 18:53:14 +0100 Bart Schaefer wrote: > On Sep 4, 10:43am, Com MN PG P E B Consultant 3 wrote: > } > } That is, if I have an assignment > } > } x='~linus ~steve' > } > } Is there also a simple solution, which expands $x to the home > } directories of linus and steve, with spacing preserved? > > There's a complicated solution: > > setopt extendedglob > print -r ${(j//)${(s/|/)~${x/(#b)( ##)/|$match|}}} >... > I'm actually a little surprised that this works -- I would have > guessed that joining with (j//) took place before tilde expansion. > But it seems to work as far back as backreferences (#b) do, so I > guess it's safe to assume it'll keep working. (PWS, does something > need to be added to the "Rules" section under "Parameter Expansion"?) I think (though I haven't checked) that it's because of the prefork() in multsub(), which gets called for subexpressions. This means that all forms of $-style expansion as well as ` and ~/= expansion get handled at each level at which a nested ${...} is processed. Yes, this probably ought to be documented if anyone understood it well enough. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/