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
array[i*1000+j]=whatever

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

Reply via email to