1 # To: chet@ins.CWRU.Edu
2 # Subject: Bash functions
3 # From: Sandeep Mehta <sxm@philabs.Philips.Com>
5 ##########################################
7 # repeat - clone of C shell builtin `repeat'
9 # usage: repeat <count> <command>
11 # It has been tested inside other functions and in conditionals like
12 # if [ "`repeat <count> <command>`" ]; then COMMANDS [ else COMMANDS ] fi
13 # Please send me fixes/enhancements.
15 # Sandeep Mehta <sxm@philabs.Philips.Com>
16 ##########################################
21 if [ $# -le 1 ] || [ -z "$rcount" ]; then
22 echo "usage: repeat <count> <command>" 1>&2
30 if [ $rcount -le 0 ]; then
31 echo "count must be greater than 0"
32 echo "usage: repeat <count> <command>" 1>&2
37 while [ $rcount -gt 0 ]; do
40 rcount=$((rcount - 1))