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

Re: Array expansion interacts with brace expansion in the wrong order

On Fri, 14 Jul 2017 10:45:55 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> This might be worth saying explicitly --- though things like this are
> implicit throughout zsh's expansion rules.

I wonder if it's also worth expanding the following?  Having reread it
in the light of Anders' query I realised "in one step" might be a bit
misleading.  Other suggestions welcome.

I'm not, to be honest, quite sure what "in one step" really meant.
I think it meant the each command line argument was changed completely
before moving onto the next.  But even if it did, that's not
*quite* right if you consider that you might generate extra arguments
from an earlier step which then need processing themselves in left
to right order.  All in all, I think obscuring the fact that the
expansions happen one after the other is unhelpful, however we tackle


diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index d161b0b..5b26f36 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -21,9 +21,12 @@ xitem(em(Parameter Expansion))
 xitem(em(Command Substitution))
 xitem(em(Arithmetic Expansion))
 item(em(Brace Expansion))(
-These five are performed in one step in left-to-right fashion.  After
-these expansions, all unquoted occurrences of the characters `tt(\)',
-`tt(')' and `tt(")' are removed.
+These five are performed in left-to-right fashion.  On each argument,
+any of the five steps that are needed are performed one after the other.
+Hence, for example, all the parts of parameter expansion are completed
+before command substitution is started.  After these expansions, all
+unquoted occurrences of the characters `tt(\)',`tt(')' and `tt(")' are
 item(em(Filename Expansion))(
 If the tt(SH_FILE_EXPANSION) option is set, the order of expansion is

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