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

Re: order of processing in brace expansion

Bart wrote:
> > That is, in all versions of zsh so far, using a parameter expansion is a
> > way to quote commas against brace expansion while still getting filename
> > generation after the expansion.
> I was wondering whether there might be some sort of compromise, such as
> only tokenizing commas when BRACE_CCL is set.

I don't really like filling the code full of this sort of dependency,
unless it can be proven that someone, somewhere was using this particular
hack which none of us here even suspected existed until a few days ago.

But it has just occurred to me that actually the fix results in some other
illogical results.

% foo='{a,b}'
% print $~foo
% print {$~foo}
{a b}

This is rather hairy.  The obvious fix is to tokenize braces, too.  This
seems to do the trick, but the change of behaviour is now much more
obvious.  We probably ought to make it either all or nothing.  Bash doesn't
expand braces that result from parameters (probably due to the ordering of
expansions).  Any suggestions?  It doesn't seem worth an option.

Index: Src/glob.c
RCS file: /cvsroot/zsh/zsh/Src/glob.c,v
retrieving revision 1.16
diff -u -r1.16 glob.c
--- Src/glob.c	2001/05/02 09:53:32	1.16
+++ Src/glob.c	2001/05/02 15:22:28
@@ -2374,6 +2374,8 @@
 	case '?':
 	case '=':
 	case ',':
+	case '{':
+	case '}':
 	    for (t = ztokens; *t; t++)
 		if (*t == *s) {
 		    if (bslash)
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

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