There is a command called seq (Sequence).
seq takes three parameter. The first parameter is the startnumber. The second is the step the start number will increment with until it reaches the third parameter. The endnumber.
seq 1 1 10 gives an array like: 1 2 3 4 5 6 7 8 9 10
seq 1 2 5 gives you: 1 3 5
If you want to do something 10 times you can use a for loop:
for i in `seq 1 1 10`
do
echo "hello $i"
done
Just play a little bit around with it.
You can also do something like that:
ReplyDeletefor ((i=1; i<=10; i++))
do
echo "hello $i"
done
(A C-like syntax)