1

i have a script which get datas from a file, but some parameters have more values than just one.

How can i make that my bash script can read as example:

user[3][1]=test1
user[3][2]=test2

Actually i make:

for i in $(seq ${#lala[@]}); do
${user[$i]}
done

which works. I have try it with ${user[$i][$i]} and seq ${#lala[@][@]}) but i cant get it running.

The script must then work with just [$i] and [$i][$i].

Can please somebody help me out, thanks a lot!

user2933212
  • 303
  • 2
  • 4
  • 11

1 Answers1

1

Well you're using wrong language/script, since BASH doesn't support multi-dimensional arrays. Having said that you can store a delimited text in each element of array that you can further break into array inside a loop.

anubhava
  • 761,203
  • 64
  • 569
  • 643