我对FOR循环的行为感到有点困惑。
#!/bin/bash
y=5
echo $y
for i in {1.. $y }
do
echo "This is test:$i "
done
输出:
5
This is test:{1..5}
预期产出:
5
This is test:1
This is test:2
This is test:3
This is test:4
This is test:5
/bin/bash
这里我不明白为什么变量的值没有在for循环中分配为{1..5}
,如果分配为什么它没有迭代5次。