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

Re: Copy assiociative arrays



Hey,

what about

$ declare -A foo bar
$ foo=(a 42 b 54)
$ bar=(${(kv)foo})
$ print ${(kv)bar}
a 42 b 54

> using this, bar only contains the values of foo (and using ${(kv)foo}
> instead still only makes it a string).

Yes, because you didn't put it into parenthesis, bar=${(kv)foo} vs
bar=(${(kv)foo})

Kind regards,
mo



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