All you do is specify the number of repetitions, followed by the command you want to re-execute. A trivial example would be:
repeat 4 echo Enter name:Enter name: Enter name: Enter name: Enter name:
Simple, right? Just imagine what Jack Nicholson could have done in the movie The Shining if he had traded in his typewriter for a UNIX system:
repeat 500 echo "All work and no play makes Jack a dull boy."
Ok, this is fun at first, but you may soon wonder whether this command has any down-to-earth uses. It does, and I'll conclude with some more useful examples:
Print three copies of memo:
repeat 3 pr memo | lp
Runfour times to clear a directory stack:
repeat 4 popd
Append 50 boilerplate files to report:
repeat 50 cat template >> report
Some versions of the C shell repeat command have a quoting bug. See the end of article 47.2.