Is there a standard UNIX tool to repeat a command any number of times?
Solution 1:
Yes this is possible. Bash has a very extensive scripting language. In this case:
for i in {1..100}; do echo 'hello'; done
More looping examples: http://www.cyberciti.biz/faq/bash-for-loop/
Full bash reference: http://www.gnu.org/software/bash/manual/bashref.html
Solution 2:
The for loop syntax is silly. This is shorter:
seq 10|xargs -I INDEX echo "print this 10 times"
Solution 3:
Or would I write to do some kind of loop in bash?
Yes, you would, like this:
for(( i = 0; i < 100; i++ )); do echo "hello"; done
or, shorter:
for((i=100;i--;)); do echo "hello"; done
Solution 4:
In addition to more built in methods you could use an external utility that generates a sequence of numbers.
# gnu coreutils provides seq
for i in $(seq 1 100) ; do printf "hello\n" ; done
# freebsd (and probably other bsd) provides jot
for i in $(jot - 1 100) ; do printf "hello\n" ; done