I'd like create an array of subarrays made of strings, and get all the subarray values at once for each subarray in the main array.
For example, I'm hoping to get "str1" "str2" to print out the first time, but instead it actually prints out "sub1"
#!/bin/bash
declare -a arr=(sub1 sub2)
declare -a sub1=("str1" "str2")
declare -a sub2=("str3" "str4")
for item in "${arr[@]}"; do
echo $item
done
I want this behavior so I can later call a script and pass "str1" "str2" to an argument that takes two values. Then I'd like to run the script again with "str3" "str4"