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

Re: Getting rid of temporaries...



On Sep 12, 11:27am, Oliver Kiddle wrote:
}
} 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.

It's not eval that quotes that, it's [[ ]].  The argument to -z et al.
is never expanded as a glob pattern.

If you use [ -z ... ] instead, you'll get better results.  Well, except
in 4.0.6, where you'll get a core dump, but that seems to be fixed in
4.0.7 and 4.1.1.

So without the function, it's

print -l *.??.jpg(e@'eval "[ -z ${~REPLY:r:r}.<${~REPLY:r:e}->.jpg(N[2]) ]"'@)

where @ is chosen as a character that appears nowhere in the expression.



Messages sorted by: Reverse Date, Date, Thread, Author