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

Re: Expansion bug?



Chris Hillery <cjh@xxxxxxx> wrote:
> 
> I don't recall seeing this mentioned before, although I've kind of
> been skimming the list for some time.
> 
> In zsh2.6-beta1, I had the following statement:
> 
>   set -A cdpath $ROOT/{$PROJ,${(j:,:)PROJ_LIST}}/src
> 
> The part between braces expanded to a comma-separated list of $PROJ
> and then the elements of the array $PROJ_LIST (which I turned into a
> comma-separated list with the (j:,:) ).
> 
> This expanded via brace-expansion into a collection of paths like so:
> 
>  /root/project/src /root/a_proj/src /root/b_proj/src    etc.
> 
> However, when I upgraded to zsh2.6-beta10 recently, this broke. (I

The proper way to do this in recent zsh releases is

set -A cdpatch $ROOT/{$PROJ,${^PROJ_LIST}}/src

However your original method probably still works if glob_subst is set (I
haven't tried). There was a bugfix which changed that. In early zsh versions
${(s:,:)foo} did not split foo at commas as this comma here become a comma
token which is not the same as a comma character. That's why your method
worked in early versions: brace expansion needs a comma token. And if
glob_subst is set, the result of substitution is tokenized.

Cheers,
   Zoltan



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