Заполнение массива значением

Массивы и коллекции / Массивы

value=5
count=3

arr=()
for ((i = 0; i < count; i++)); do
    arr+=("$value")
done
#arr is (5 5 5)

#yes repeats a line without end, head takes as many as needed
mapfile -t fromYes < <(yes "$value" | head -n "$count")
#fromYes is (5 5 5)

#a string of one character: %.0s prints its argument as nothing,
#so printf prints "-" once for every number of the range
line=$(printf -- '-%.0s' {1..10})
#line is "----------"

#a range takes no variables: {1..$count} stays as it is,
#because the braces are expanded before the variables
braces=$(echo {1..$count})
#braces is "{1..3}"

echo "arr is (${arr[*]})"
echo "fromYes is (${fromYes[*]})"
echo "line is $line"
echo "braces is $braces"