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

Re: associative array questions



On Sun, Dec 11, 2022 at 12:52 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> Before?  Nuts I thought the substitutions always happened first.

Parsing has to happen first, otherwise it's not possible to find what
to substitute ...

> > You could also do (another thing that doesn't work in older zsh)
> >    eval "${aarray}+=([second]='tea for two')"
> Of course I'm trying to avoid the eval entirely.  You've always advised
> against it.

You can do

  typeset -g -- "${aarray}[second]"='tea for two'

to avoid eval.  Unfortunately typeset doesn't allow the += syntax.




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