Bash script - variables in curly braces
Variables won't expand inside brace expansion. You could do:
for ((number=startNumber; number<=endNumber; number++)); do
echo "$number"
done
Also, there is no reason to use arithmetic expansion for startNumber
you should simply do:
startNumber=1
.
Additionally, you don't need to use $
to expand variables inside arithmetic expansion, so endNumber
could be:endNumber=$((startNumber+3))
As explained elsewhere the expansion won't work. Alternative way to get your sequence of numbers:
for number in $(seq $startNumber $endNumber)
do
echo $number
done