If your range has a variable, use seq, like this:
seq
count=10for i in $(seq $count); do commanddone
Simply:
for run in {1..10}; do commanddone
Or as a one-liner, for those that want to copy and paste easily:
for run in {1..10}; do command; done
Using a constant:
for ((n=0;n<10;n++)); do some_command; done
Using a variable (can include math expressions):
x=10; for ((n=0; n < (x / 2); n++)); do some_command; done
Another simple way to hack it:
seq 20 | xargs -Iz echo "Hi there"
run echo 20 times.
Notice that seq 20 | xargs -Iz echo "Hi there z" would output:
seq 20 | xargs -Iz echo "Hi there z"
Hi there 1 Hi there 2 ...