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

Re: associative array questions



On Tue, Dec 13, 2022 at 2:47 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> > eval 'list=( "${(@M)list:#(#i)*$SEARCHBUF*}" )'     # filter the array.
>
> > That second line isn't doing anything like what you want.
>
> But it does work perfectly.

It would work for the case where the array you want to rewrite is
actually named "list".  There's no way it can work for an array
indirectly named by the parameter $list.

Either you're not actually showing us what you're doing, or you're not
doing what you're telling us you are.

The closest thing that would do what you say you want is

eval $list'=( "${(@M)'$list':#(#i)*$SEARCHBUF*}" )'




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