Use seq
or jot
. You may need to use backticks instead of $()
.
for i in `seq 1 3`
If the shell in the version of QNX you're using is ksh, then you should be able to use C-style for
loops:
for ((i = 1; i <=3; i++ ))
Edit:
I'm now guessing that you have QNX 4 which has a ksh86 clone as its shell. In my opinion, under these circumstances, it is brain dead to not include seq
or jot
. However, all that aside, here is a hack that should be able to do sequences:
end=3
for n in $(echo "for (i = 1; i <= $end; i++) i" | bc)
do
echo "$n"
done