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

Re: transformations of glob results



On Wed, Sep 23, 2015 at 10:06 AM, Marc Chantreux <khatar@xxxxxxxxx> wrote:
> hello people,
>
> i wrote a glob result transformation that way:
>
>     l=( /etc/sympa/*/robot.conf(:h:t) )
>     l=( listmaster@$^l )
>     print ${(j:,:)l}
>
> but i really would like to know if there is a simple, readable way to
> write it in one expression.

Not really, parameter expansion takes place before globbing so you
need to do the * separately before the other stuff. You can cheat and
do things with e:: but that is much slower in this case (and
technically the thing inside the :: is a separate expression too), or
use an anonymous function but all that really does is give you a free
local variable, (eg, () { print ${(j:,:):-listmaster@$^@}} }
/etc/sympa/*/robot.conf(:h:t) (not tested, may have typos) )

-- 
Mikael Magnusson



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