i am trying to make a multidimaensional array in bash and access the elements. but its not working.
I tried with this code but there's error
# Create an indexed array to hold the inner arrays
array=()
# Initialize the inner arrays
array[0]=(1 2 3)
array[1]=(4 5 6)
array[2]=(7 8 9)
# Access elements
element_12="${array[1][2]}"
echo "Element at [1][2]: $element_12"
# Loop through the elements
for ((i = 0; i < ${#array[@]}; i++)); do
inner_array=("${array[i][@]}") # Copy the inner array
for ((j = 0; j < ${#inner_array[@]}; j++)); do
echo "Element at [$i][$j]: ${inner_array[j]}"
done
done