From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9583 invoked from network); 23 Aug 2006 03:27:09 -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.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO,UNPARSEABLE_RELAY 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; 23 Aug 2006 03:27:09 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 70303 invoked from network); 23 Aug 2006 03:26:59 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Aug 2006 03:26:59 -0000 Received: (qmail 13935 invoked by alias); 23 Aug 2006 03:26:52 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10638 Received: (qmail 13925 invoked from network); 23 Aug 2006 03:26:51 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 23 Aug 2006 03:26:51 -0000 Received: (qmail 69218 invoked from network); 23 Aug 2006 03:26:51 -0000 Received: from vms042pub.verizon.net (206.46.252.42) by a.mx.sunsite.dk with SMTP; 23 Aug 2006 03:26:50 -0000 Received: from torch.brasslantern.com ([71.121.0.226]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0J4F0016MLJYWTKA@vms042.mailsrvcs.net> for zsh-users@sunsite.dk; Tue, 22 Aug 2006 22:26:23 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id k7N3QLNJ007568 for ; Tue, 22 Aug 2006 20:26:22 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id k7N3QGAv007567 for zsh-users@sunsite.dk; Tue, 22 Aug 2006 20:26:16 -0700 Date: Tue, 22 Aug 2006 20:26:16 -0700 From: Bart Schaefer Subject: Re: e:: with an array ? In-reply-to: <20060822204536.GA11639@ulpmm.u-strasbg.fr> To: zsh-users Message-id: <060822202616.ZM7566@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <20060822204536.GA11639@ulpmm.u-strasbg.fr> Comments: In reply to Marc Chantreux "e:: with an array ?" (Aug 22, 10:45pm) On Aug 22, 10:45pm, Marc Chantreux wrote: } } print -l *(e:true:) } } works but } } x=(*); print -l ${(e:true:)x} } } is an error. In general there's no correlation between glob qualifiers and parameter expansion flags, so you shouldn't expect that. E.g. ${(U)x} means to convert $x to uppercase, but *(U) means to match files owned by the current effective user ID. One could argue that given (N) to turn on NULL_GLOB and (D) to turn on GLOB_DOTS, there should also be a way to turn on NO_NOMATCH so that one could force an (e::) qualifier to be applied to nonexistent files. However, NO_NOMATCH normally means that the entire pattern _including_ qualifiers must be preserved unchanged on a match failure, so turning it off within the qualifiers is a logical quandary. Note also that even with NO_NOMATCH, *(e:false:) fails with "no such file." } I haven't found an alternative in the doc so i wonder again } (http://www.zsh.org/mla/users//2006/msg00193.html) if there is a kinda } perl grep :-) If you mean grep { func } @x as in map { if (func) { $_ } else { () } } @x then no, there is no direct zsh equivalent, except in the special case where func is the zsh equivalent of m/pattern/. With extendedglob set, zsh does have ${x/(#b)(*)/$(func $match)}, which can be made to behave mostly like perl map. If func is limited to things that can be expressed as parameter expansion operations, you can change $(...) to ${...}, save a fork, and annoy Matthias Kopferman.