bug-bash
[Top][All Lists]
Advanced

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

Re: Any chance of multi-dimensional arrays?


From: Dennis Williamson
Subject: Re: Any chance of multi-dimensional arrays?
Date: Sun, 25 Nov 2012 08:19:48 -0600

On Nov 25, 2012 1:37 AM, "Rene Herman" <address@hidden> wrote:
>
> 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
>

Why don't you write it in Python? It will be much easier. You can use
advanced data structures and can even store your data in a database such as
MySQL. Execution will be much faster, too.


reply via email to

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