Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Keying arrays to names: is there an array of arrays?
- X-seq: zsh-users 10317
- From: "Johann 'Myrkraverk' Oskarsson" <johann@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Keying arrays to names: is there an array of arrays?
- Date: Sat, 27 May 2006 19:09:51 +0000
- In-reply-to: <200605261540.k4QFeReG007573@xxxxxxxxxxxxxx> (Peter Stephenson's message of "Fri, 26 May 2006 16:40:27 +0100")
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <m33bewj29n.fsf@xxxxxxxxxxxxxxxxxx> <44771E3E.9070102@xxxxxxxxxxxxxxxxxx> <200605261540.k4QFeReG007573@xxxxxxxxxxxxxx>
Peter Stephenson <pws@xxxxxxx> writes:
> This reminds me I was going to post a general solution along the same
> lines which deals with embeded spaces etc.:
Is it possible to abstract that trick into functions? That is, so the
function takes the array name, key, and value as arguments? My feeble
attempts have failed.
> % array=(one 'two three' '"four five six"')
> % typeset -A hash
> % array=(${(q)array})
> % hash[key]="${array}"
> % array=(${(Q)${(z)hash[key]}})
> % print -rl $array
> one
> two three
> "four five six"
Johann
--
johann myrkraverk com (you know the drill with the @ and .)
I classify Outlook mail as spam, use something else.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author