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

Re: Is outer quoting not needed (docs say "redundant")?



On Sat, Jan 13, 2018 at 8:50 AM, Sebastian Gniazdowski
<psprint@xxxxxxxxxxx> wrote:
>
> arr=( "${(@Q)${(z@):-"a b" c}}" )
>
> arr=( "${(@Q)${(z@):-a\\ b c}}" )

These are not the same.  Because of the way backslashes behave when
they follow the :- operator plus the effect of the (z) flag, the
latter is actually the same as

arr=( "${(@Q)${(z@):-"a\ b" c}}" )

You can see this if you examine the inner expansion in isolation:

% print -rl ${(z@):-"a b" c}
a
b
c
% print -rl ${(z@):-a\\ b c}
a\ b
c



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