for i in {0..3}
do
echo $i
done
返回
0
1
2
3
但是
firstNumber=$1
lastNumber=$2
for i in {$firstNumber..$lastNumber}
do
echo $i
done
例如,返回
{0..3}
如何在For循环声明中使用变量?
答案 0 :(得分:0)
for ((i=$firstNumber; i <= $lastNumber; i++)); do echo $i; done