bug-bash
[Top][All Lists]
Advanced

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

Any chance of multi-dimensional arrays?


From: Rene Herman
Subject: Any chance of multi-dimensional arrays?
Date: Sun, 25 Nov 2012 06:33:19 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0

Good day.

I know that bash arrays are 1 dimensional -- but are there any plans for providing multi-dimensional arrays?

I'm currently writing a larger bash script to manage my (ogg vorbis) music collection, including maintaining tags. Vorbis files can and (mine) often will contain repeated tags such as, say, "artist=David Crosby" and "artist=Graham Nash" and so on and as such, my "artist" variable is an array.

However, the same things holds for any tag and I'm currently managing separate title, artist, genre, date, album, tracknumber, disc and discnumber arrays with fairly ugly "manual loops", whereas I would much prefer to call them "tag[i]" instead and loop over them with actual for loops. Given that tag[i] is itself an array, I can't do that though.

When you google for this issue, you find various contrived emulations of multi-dimensional arrays through function-accessors and such, but that's not really what I want to do. Thought I'd see if a suggestion that multi-dimensional arrays would really be much welcome would be welcome here...

The things I'm trying to do with this script seem to most naturally belong to the realm of scripts and as such, I'm reluctant to switch to a different language. And, in fact, I'm sort of satisfied how this is now working. It's just that the code would much improve from multi-dimensional array support.

Kind regards,
Rene



reply via email to

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