Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Getting rid of temporaries...



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