Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Copy assiociative arrays
- X-seq: zsh-users 16917
- From: Moritz Bunkus <moritz@xxxxxxxxxx>
- To: René Neumann <lists@xxxxxxxxx>
- Subject: Re: Copy assiociative arrays
- Date: Wed, 21 Mar 2012 22:46:47 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bunkus.org; s=mail201203; t=1332366408; bh=Nw9sz1sd+DdmYW+mSLKo6Ipgl3+NqvsFWRrbSKP2bWI=; h=MIME-Version:In-Reply-To:References:Date:Message-ID:Subject:From: To:Cc:Content-Type; b=h1ESuqnowBKYaOOyxCQBfqQ+7cFpmhA9GIDjKdpy9yXfU3ndU9evtNeJh1QFaM8F1 ADs94xQ4BqBS2puMOVM8LlsefwLflVDB8Cs04TTov3aoapzye/OFFLaUJkEqW/bQfP E9+mAhKICY6JLTuH38fKl8LYuTNhCwrVQptykJm4=
- In-reply-to: <4F6A4818.3010702@necoro.eu>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <4F6A4818.3010702@necoro.eu>
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