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

Re: [patch] Fix VCS_INFO_reposub's whitespace handling

On Sun, 28 Sep 2014 19:10:33 +0200
Marco Hinz <mh.codebro@xxxxxxxxx> wrote:
> Could someone point me to the appropriate parameter expansion rule?


${$(pwd -P)#$base/}

you're hitting the special rule applied to the command substitution
rather than the parameter substitution.

Zsh is actually less likely (by default) to split substitutions than
other shells, but for $(...) it works the same way other shells do.  You
wouldn't hit this just with parameter substitution unless you had the
option SH_WORD_SPLIT set.  See the section COMMAND SUBSTITUTION in the
zshexpn manual page.  The second sentence is the exact rule.

The only effect parameter substitution has on the result is the explicit
one, i.e. removing $base/ from the head of the nested result.  If you
want the full hairy list of parameter rules (hint: you don't) search for
"brain damage" in zshexpn.

For nested operations involving command substitions, the description is
a couple of paragraphs above "Parameter Expansion Flags".  The following
paragraph, indicating you can double-quote just the nested command
substitution, is also relevant (your patch looks fine as it is since
we're dealing throughout with one word).

Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/

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