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

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



On 13 Dec 2017 at 12:34:08, Peter Stephenson (p.stephenson@xxxxxxxxxxx) wrote:
> On Wed, 13 Dec 2017 08:00:51 +0100
> Sebastian Gniazdowski wrote:
> > gitout=( "${(@f)"$( "${gitcmd[@]}" )"}" )
> >
> > Is it the same?
> 
> It should be, because the count of braces doesn't go to zero between the
> first "${" and the last "}" (see the rules I summarised last time). So
> only the final double quote causes quoting to end.

Going this way, in following braces also don't go zero.. But maybe it's not a bug:

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

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

It would be an interesting case because inner quotes wouldn't be a no-op.

-- 
Sebastian Gniazdowski
psprint /at/ zdharma.org



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