[Pkg-zsh-devel] Bug#654444: zsh: `q' flag for paramater expansion does not work as advertised

Samuel Bronson naesten at gmail.com
Sun Jan 15 04:30:12 UTC 2012


On Tue, Jan 3, 2012 at 5:58 PM, Frank Terbeck <ft at bewatermyfriend.org> wrote:
> Samuel Bronson wrote:
> [...]
>> ,----
>> | q
>> |      Quote the resulting words with backslashes; unprintable or invalid
>> |      characters are quoted using the $'\NNN' form, with separate quotes
>> |      for each octet.  [...]
>> `----
>>
>> Unfortunately, the second clause seems to be only half correct;
>> unprintable characters do get wrapped in $'...', but not \NNN escaped:
>>
>> ,----
>> | naesten at hydrogen:~/hacking/crawl/crawl-ref/source% echo -n ${(q)$(echo
>> | -e "\e")}|hd
>> | 00000000  24 27 1b 27                                       |$'.'|
>> | 00000004
>> `----
>>
>> Of course, what I'd *really* like would be for this to get escaped as
>> \e, not \NNN, but I was at least expecting the documented behavior!
>
> This is not a bug.  It's echo being echo (ie. a load of $swearword).
>
> zsh% printf '%s\n' ${(q)$(echo -e "\e")}
> $'\033'
>
> Regards, Frank

Oh, really? Leaves one wondering about the point of "echo -e"...





More information about the Pkg-zsh-devel mailing list