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!

0

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

6 Comments

So you mean user[3]=test1,test2? Do you maybe have a code example how can i use it in a script to read all values one after one?
If you can provide some sample data in your question on what your input is then I can sure make a script for you.
I saw your script but unable to understand where you want 2D array.
${hdd[$i]} must be 2d array
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.