Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Getting rid of temporaries...
- X-seq: zsh-workers 19060
- From: Danek Duvall <duvall@xxxxxxxxxxx>
- To: Zsh <zsh-workers@xxxxxxxxxx>
- Subject: Re: Getting rid of temporaries...
- Date: Wed, 10 Sep 2003 15:38:45 -0700
- In-reply-to: <20030910203429.GA354@DervishD>
- Mail-followup-to: Danek Duvall <duvall@xxxxxxxxxxx>, Zsh <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20030910203429.GA354@DervishD>
I'm not sure if it's possible to get rid of the temporary *and* the uniq
in a simple fashion, but:
typeset -U array
array=( /directory/*/* )
array=( ${^array%.<00-99>.jpg} )
print -l $array
will do what you want. The "typeset -U" makes $array discard duplicate
elements, but that requires the reassignment once the dups are gone,
though it might be a nice candidate for yet another parameter expansion
flag. :)
The "^" turns on rcexpandparam for the expansion of $array, which means
that, as an array, each element is modified. And I turned your "??"
into "<00-99>", which explicitly only matches two-digit numbers (you
could also use "<->" to match all numbers).
Danek
Messages sorted by:
Reverse Date,
Date,
Thread,
Author