Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: transformations of glob results
- X-seq: zsh-users 20631
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Marc Chantreux <khatar@xxxxxxxxx>
- Subject: Re: transformations of glob results
- Date: Wed, 23 Sep 2015 15:49:34 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=K3k2vzvfqKEIBAQgoTCrNeqnMm5GoYdjDHTqTcYWj0Q=; b=GNBqjlBnz9l4a8uTN4V+lPm5fYkGlg3lnRgqzALi44r+Mx3TZXEhoFHGvB0uJ+UrKC WgNXuMbQgtLBx7z7pJBMzYrgNIpXM+kwFL8lLjfrPMtz0dM0LVJaF+iIkiN+aMfp3ysU TVHG/Xjt09plz1/9hN/8H7IfedB78n0QM0R/jnQO1ZSHs2hmwsW5sFmtB49w9EvvbTMp IhiAK9mJSn8smuowfdraswBsfqCNjHZUstivvVbePLOFyp+76l8ilWKgXZls/Hi17FeM g8PvxTCXuPihHNRhfohM9YOQGOt6K0w8rlDV8lKzjLg/qrprCx269MEMHecbZWaSRc9c IPkg==
- In-reply-to: <20150923080648.GA1294@ramirez.u-strasbg.fr>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20150923080648.GA1294@ramirez.u-strasbg.fr>
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