I've a script named t.sh as below:
#!/bin/bash
num=2
for i in {0..$((num-1))}; do
echo 'aaa'
done
for i in {0..1}; do
echo 'bbb'
done
The output of ./t.sh:
aaa
bbb
bbb
I can't understand at all. $((num-1)) equals to 1, so I think aaa should be printed twice, just like bbb, why it shows only once?