Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: double quoted expansion question
- X-seq: zsh-users 17227
- From: Jérémie Roquet <arkanosis@xxxxxxxxx>
- To: Sebastian Stark <seb-zsh@xxxxxxxxxxx>
- Subject: Re: double quoted expansion question
- Date: Fri, 7 Sep 2012 14:47:08 +0200
- Cc: 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:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=mFo4Io8xwNSO8HgPknXktOB64eq1818jFDQGmqOGr7I=; b=jsAnkjrGqOq9z1/hs7m5da8Ds+iVjZzRScF7airT+XHOVUzf30zPGdCxusrH0UD5xZ DdeH6DWwK0Mm326C/lJKA7fUSJR4E5cDMFvFyEZzFiv2xHAF3R8ywuWD9YXPlTd+gUWv Bzz0LB/80jpH3QxxdqedGqnv+AePo9Xii1fztcU5vwB2lLehkQ0Bjvve8AiCm7Dkffoh 4uLzjNmMfFmIXqiucSZU1J3Oi1I8n/Q85ypHO54eLJJqeS3BJUj0zczsNcTYmfutRhto utHJGeKhCFRcN40QD8VPhs5PCE/IbrdILAngSgVUJV3A77zWwNNdn9FRZnib/CsxiN32 /Y2g==
- In-reply-to: <29236168-55B5-4555-9ACA-B1D21D345EA9@biskalar.de>
- 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: <29236168-55B5-4555-9ACA-B1D21D345EA9@biskalar.de>
Hi,
2012/9/7 Sebastian Stark <seb-zsh@xxxxxxxxxxx>:
> I am trying to make a unique list of tags that is given in a string with a certain format, e. g.:
>
> servers="
> madeira linux,gpu,users
> madeira2 linux,gpu,users
> smtp linux,mail,smtp
> isar linux,users
> easygwa linux,web,external
> "
>
> The format is: server name, space, tag, comma, tag, comma, tag ...
>
> What I want from the above list is this:
>
> external gpu linux mail smtp users web
>
> and I get it with:
>
> print ${(s:,:uo)${(j:,:)${${(f)servers}//* /}}}
>
> However, if I do this:
>
> print "${(s:,:uo)${(j:,:)${${(f)servers}//* /}}}"
>
> I get:
>
> external linux web
>
> This also happens when I use the variable expansion expression in a here document, which, I suppose, is undergoing the same treatment as double quoted strings.
>
> What I would like to understand here is why the output changes the way it does when I add double quotes around my expression. I would expect the same output as without. If anybody could shed some light please, I guess it's just something obvious I cannot see.
I'm not 100 % sure, but I suppose the quotes prevents the shell from
splitting your string on $IFS, so you only have *one* string, and the
“//* /" expression suppresses everything before the last space,
leaving only the tags of the last line.
Best regards,
--
Jérémie
Messages sorted by:
Reverse Date,
Date,
Thread,
Author