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

Re: Copy assiociative arrays



On 21 March 2012 22:28, René Neumann <lists@xxxxxxxxx> wrote:
> Hi all,
>
> is it possible to copy associative arrays?
>
> I.e. have
>
> declare -A foo bar
> foo=(muh vier bla "\\sechs")
> bar=$foo
>
> using this, bar only contains the values of foo (and using ${(kv)foo}
> instead still only makes it a string).

You still need the () when assigning to an array, even if the values
come from an array expansion
bar=( ${(kv)foo} )

-- 
Mikael Magnusson



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