From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3428 invoked from network); 27 Apr 2001 18:10:30 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Apr 2001 18:10:30 -0000 Received: (qmail 20938 invoked by alias); 27 Apr 2001 18:10:25 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14140 Received: (qmail 20924 invoked from network); 27 Apr 2001 18:10:25 -0000 Message-ID: To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: order of processing in brace expansion In-Reply-To: Your message of "27 Apr 2001 11:31:48 MDT." Date: Fri, 27 Apr 2001 19:09:56 +0100 From: Peter Stephenson Allan Poindexter wrote: > Consider the following: > > pts/11 10:37 208%setopt braceccl > pts/11 10:38 209%foo=b,c > pts/11 10:38 210%echo a{$foo}d > a,d abd acd > > Can anyone shed any light on what I might be overlooking here? By default, parameters in zsh are expanded without turning the contents into tokens, so the comma is just treated as a normal character, just as if you had typed a{'b,c'}d. This is the behaviour I would expect. The real bug, I would say, is this: % echo a{$~foo}d a,d abd acd The ~ force $foo to be interpreted pretty much as if the characters had been put directly on the command line (the option GLOB_SUBST does the same thing). This is done by default by a lot of other shells. In *this* case, I would expect what you expect: the expression is interpreted the same as a{b,c}d. Unfortunately it isn't. The reason seems to be that the comma doesn't get turned back into a token. If we want to fix this, the following patch will do it. Index: Src/glob.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/glob.c,v retrieving revision 1.15 diff -u -r1.15 glob.c --- Src/glob.c 2001/04/24 05:45:17 1.15 +++ Src/glob.c 2001/04/27 17:57:25 @@ -2373,6 +2373,7 @@ case '*': case '?': case '=': + case ',': for (t = ztokens; *t; t++) if (*t == *s) { if (bslash) -- Peter Stephenson 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 prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************