I have gotten the following to work:
for i in {2..10}
do
echo "output: $i"
done
It produces a bunch of lines of output: 2
, output: 3
, so on.
However, trying to run the following:
max=10
for i in {2..$max}
do
echo "$i"
done
produces the following:
output: {2..10}
How can I get the compiler to realize it should treat $max as the other end of the array, and not part of a string?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…