ossp-pkg/due/.due/due.util.sh 1.3 -> 1.4
--- due.util.sh 2004/10/22 21:17:44 1.3
+++ due.util.sh 2004/10/24 18:59:45 1.4
@@ -156,3 +156,24 @@
done
}
+# repeat a command
+function repeat () {
+ if [ $# -eq 0 ]; then
+ echo "Usage: repeat <number>|oo <command> [...]" 1>&2
+ return 1
+ fi
+ count="$1"
+ shift
+ if [ ".$count" = .oo ]; then
+ while true; do
+ eval "$@" || exit $?
+ done
+ else
+ local i=0
+ while [ $i -lt $count ]; do
+ eval "$@" || exit $?
+ i=$(($i + 1))
+ done
+ fi
+}
+
|
|