From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25202 invoked from network); 12 Sep 2003 09:25:54 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 12 Sep 2003 09:25:54 -0000 Received: (qmail 27299 invoked by alias); 12 Sep 2003 09:25:48 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19071 Received: (qmail 27288 invoked from network); 12 Sep 2003 09:25:48 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 12 Sep 2003 09:25:48 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.211] by sunsite.dk (MessageWall 1.0.8) with SMTP; 12 Sep 2003 9:25:47 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-13.tower-36.messagelabs.com!1063358744!501782 X-StarScan-Version: 5.0.7; banners=-,-,- Received: (qmail 21895 invoked from network); 12 Sep 2003 09:25:44 -0000 Received: from porgy.logica.co.uk (158.234.250.67) by server-13.tower-36.messagelabs.com with SMTP; 12 Sep 2003 09:25:44 -0000 Received: from iris.logica.co.uk (iris.logica.co.uk [158.234.9.163]) by porgy.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id h8C9PhvB007586; Fri, 12 Sep 2003 10:25:44 +0100 Received: from gmcs3.local ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id h8C9PhDB028776; Fri, 12 Sep 2003 10:25:43 +0100 Received: from gmcs3.local (localhost [127.0.0.1]) by gmcs3.local (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h8C9Rvg22664; Fri, 12 Sep 2003 11:27:58 +0200 X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- In-reply-to: <20030911093927.GC50@DervishD> From: Oliver Kiddle References: <20030910203429.GA354@DervishD> <20030910223845.GA10805@lorien.emufarm.org> <1030911010623.ZM7489@candle.brasslantern.com> <1378.1063261796@gmcs3.local> <20030911093927.GC50@DervishD> To: DervishD , Zsh Subject: Re: Getting rid of temporaries... Date: Fri, 12 Sep 2003 11:27:57 +0200 Message-ID: <22662.1063358877@gmcs3.local> DervishD wrote: > > Can do the unique with the `e' globbing flag but not without > > temporaries or eval. > > How can I do using eval? Assume that I don't have the (u) flag... Wasn't as easy as I thought. Thought I could do something like: guniq() { eval "[[ -z ${~REPLY:r:r}.<${~REPLY:r:e}->.jpg(N[2]) ]]" } print -l *.??.jpg(e:guniq:) But eval insists on quoting the third word in what it runs so it does [[ -z 'foo.<28->.jpg(N[2])' ]] which is no use. The guniq() function there isn't necessary, it just makes quoting easier. You can do this though: guniq() { [[ -z "$2" ]] } print -l *.??.jpg(e['eval "guniq ${REPLY:r:r}.<${REPLY:r:e}->.jpg"']:r:r) This solution needs the separate function and is in effect using $@ as a temporary array though. Oliver