From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 963 invoked by alias); 7 Sep 2012 12:55:03 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17226 Received: (qmail 22066 invoked from network); 7 Sep 2012 12:55:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.212.43 as permitted sender) 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=zHwHudIHlSflPucEKDPRuN1bj/M4VvLM2UlPepxY2Yg=; b=fJLGJZn+BOR9fYxwfEhH8Jbusen15uDOuEWrJT46P9hrjSGfPdy1r1Jg8ppI4NFEqW Q3jNeQtGXPs90GUaEMK0NHl6woZDPhQupEMFHr+qvp+5YiCm1qFTtjp0FLstA+RKANdd PxBhtYR3NZU0cLoeDlHoSqk4npOzj1oATLrmAolRGYPYjpmWR38APKtH/5/4AwdRjWWB kRsJeaizG0DX6Ut7bbjzhN1hgufddO1aSI1j+DHzjWTX42llf2pCLSB/jqNKJwEJ0ekb gEn6kLZCYvR3TKLTPUlPWXZtJahKOXBqN3bzSxUJqccoU83+U9CKpmDQkpmjtkGL2789 3Rsg== MIME-Version: 1.0 In-Reply-To: References: <29236168-55B5-4555-9ACA-B1D21D345EA9@biskalar.de> From: =?UTF-8?B?SsOpcsOpbWllIFJvcXVldA==?= Date: Fri, 7 Sep 2012 14:54:41 +0200 Message-ID: Subject: Re: double quoted expansion question To: Sebastian Stark Cc: zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2012/9/7 J=C3=A9r=C3=A9mie Roquet : > 2012/9/7 Sebastian Stark : >> I am trying to make a unique list of tags that is given in a string with= a certain format, e. g.: >> >> servers=3D" >> 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 quo= ted strings. >> >> What I would like to understand here is why the output changes the way i= t does when I add double quotes around my expression. I would expect the sa= me 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 > =E2=80=9C//* /" expression suppresses everything before the last space, > leaving only the tags of the last line. No, this has nothing to do with $IFS actually, but you still have one strin= g: $ a=3D(za zb zc zd) $ echo ${a/z/v} va vb vc vd $ echo "${a/z/v}" va zb zc zd --=20 J=C3=A9r=C3=A9mie