[Top][All Lists]

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

Re: Any chance of multi-dimensional arrays?

From: Steven W. Orr
Subject: Re: Any chance of multi-dimensional arrays?
Date: Sun, 25 Nov 2012 15:59:12 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

On 11/25/12 14:54, quoth Bob Proulx:
Rene Herman wrote:
All I want additionally is multi-dimensional arrays...

There are various naming conventions and schemes to simulate
multi-dimensional arrays using single dimension arrays.  Since you
want to continue with the shell and the shell has not (yet) provided
multi-dimensional arrays then the only option for you is to simulate
them.  That isn't too difficult and if you search the web there are
many different implementations with the biggest difference being
whether ordering matters or not.


Good answer. One suggestion that is used in awk is to use the associative array functionality by making an index that is a list of integers that are separated by commas. Here's a quick example off the top of my shiny head:

declare -A mdlist       # Multi Dimensional list


Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net

reply via email to

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