Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: clone an associative array?
- X-seq: zsh-workers 21675
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: clone an associative array?
- Date: Fri, 19 Aug 2005 15:30:57 +0100
- Cc: zsh-workers <zsh-workers@xxxxxxxxxx>
- In-reply-to: <21138.1124461492@xxxxxxx>
- Mail-followup-to: Peter Stephenson <pws@xxxxxxx>, zsh-workers <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20050819141338.GA5747@xxxxxxxxxxxxxxxxxxxxxxx> <21138.1124461492@xxxxxxx>
On Fri, Aug 19, 2005 at 03:24:52PM +0100, Peter Stephenson wrote:
[...]
> typeset -A counterfeit
> counterfeit=(${(kv)homemade})
>
> Make sure you don't have the option SH_WORD_SPLIT set. (This is a
> classic example of why it's a good idea to get used to doing without it.)
[...]
Hmmm,
~$ typeset -A a b
~$ a=(a 1 b '' c 2)
~$ echo "$a[b]"
~$ b=(${(kv)a})
zsh: bad set of key/value pairs for associative array
Hence, the b=("${(@kv)a}") that would also work with
SH_WORD_SPLIT.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author