[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multi-dimensional arrays

From: Greg Wooledge
Subject: Re: multi-dimensional arrays
Date: Mon, 19 Sep 2011 08:31:12 -0400
User-agent: Mutt/

On Sat, Sep 17, 2011 at 08:53:32PM -0400, Chet Ramey wrote:
> On 9/17/11 10:26 AM, Gerard Seibert wrote:
> > Just out of curiosity, are there any plans to make multi-dimensional
> > array variables available in future versions of Bash? I would find it
> > extremely useful. 
> I don't have any current plans to add multi-dimensional arrays.  How
> would you use them?  Maybe there's a way to do that in the meantime.

The normal workaround is to use an associative array with keys such
as "110,42".  In the case of numeric indices like these, it can also
be done using normal arrays by choosing a sufficiently large constant
(say 1000 in this case):

i=110 j=42

Bash's sparse arrays make that a fairly memory-efficient alternative.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]