I am confused about how to declare an array in bash.
Presume:
$arr[1]=x
$arr[2]=y
$arr[3]=z
Code:
declare -A/-a object
fo var in ${arr[@]}
do
    object["a"]="${arr[1]}"
    object["b"]="${arr[2]}"
    object["c"]="${arr[3]}"
    echo ${object["a"]}
done
Output: z
What I want is :x
If I commented object["b"] and object["c"], then the output is correct:x
No matter -A or -a, still does not work. is this problem related to my bash environment?
GNU bash,version 3.2.57(1) -release (x86_64_apple-darwin18)
 
    