Shell collect out put

Hi,

I am trying to write a shell script. In the script I am trying to execute multiple commands one by one.

My requirement is I want to collect output of each line to an array. How can I do this?

arr[0] = command1
arr[1] = command2


arr[n] = commandn

If the below can be achieved then that will be better.

arr[comm][0] = command1
arr[comm][1] = command2


arr[comm][n] = commandn