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

Frank Terbeck ft at bewatermyfriend.org
Tue Jan 3 22:58:47 UTC 2012


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





More information about the Pkg-zsh-devel mailing list