when I populate an array using explicit range value it get populated correctly using the code below:
arr=()
for i in {0..10}
do
arr+=( 1 )
done
echo ${arr[@]}
and I got the following output (nothing surprising)
However, when storing the range in a variable and calling it as in the code below it only shows one element:
range=10
arr=()
for i in {0..$range}
do
arr+=( 1 )
done
echo ${arr[@]}