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

Re: double quoted expansion question



Am 07.09.2012 um 14:54 schrieb Jérémie Roquet:
>>>  print  ${(s:,:uo)${(j:,:)${${(f)servers}//* /}}}
>> 
>> 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.
> 
> No, this has nothing to do with $IFS actually, but you still have one string:
> 
> $ a=(za zb zc zd)
> $ echo ${a/z/v}
> va vb vc vd
> $ echo "${a/z/v}"
> va zb zc zd

Thanks, I just figured that this must be the kind of brain damage they mention in zshexpn(1), and using this:

  $(awk '{print $2}' <<<$servers | tr , '\n' | sort -u | tr '\n' ' ')

seems like a much saner way to achieve the same :) But not very zshy...


Sebastian


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