Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Copy assiociative arrays
- X-seq: zsh-users 16916
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: René Neumann <lists@xxxxxxxxx>
- Subject: Re: Copy assiociative arrays
- Date: Wed, 21 Mar 2012 22:44:02 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=ET2AdBS2cPc6c08n7Lbm1PQ0PUXs1ITeQYF6q8WwWcw=; b=uzUPRgdR/kYrSqQsu+6LHD7B/vLRzIdoz/WDIFpb+BIM/LFFx7GNH/pFESIkcN3waX CVBE/kuzaURiqmt4khI1j7Pwtow6BYgapVDT8WmxlMbSlMbVvb1nAP9XVz+7OJJfa1ZB q5gDf5XHLOLxw6TuOwL3OtRRMw0ZEuoUmZcg3MS2Gfu6vX8G4sXFaj/MUne09+4SAshb g8VA3frSLBVBVIgk609g6GmSxJpUFlb9N7L6hNAx+5FgTWsIy7Oh42/QK8GWqe3h1+/T 2/HQ5K3WJFSh2EaTFp2ZCYUKlVXWG5v7HI4yWHijg4ifjgedpwvV5ZTSgnDh71upNuHr IFvg==
- 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>
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