Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Getting rid of temporaries...
- X-seq: zsh-workers 19071
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: DervishD <raul@xxxxxxxxxxxx>, Zsh <zsh-workers@xxxxxxxxxx>
- Subject: Re: Getting rid of temporaries...
- Date: Fri, 12 Sep 2003 11:27:57 +0200
- In-reply-to: <20030911093927.GC50@DervishD>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20030910203429.GA354@DervishD> <20030910223845.GA10805@xxxxxxxxxxxxxxxxxx> <1030911010623.ZM7489@xxxxxxxxxxxxxxxxxxxxxxx> <1378.1063261796@xxxxxxxxxxx> <20030911093927.GC50@DervishD>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author