From b7fc9e0f6d6105ba2203f219743d4b269415e84b Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 12 Nov 2007 13:06:02 -0800 Subject: initial import from bash_3.1dfsg.orig.tar.gz --- examples/functions/repeat3 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/functions/repeat3 (limited to 'examples/functions/repeat3') diff --git a/examples/functions/repeat3 b/examples/functions/repeat3 new file mode 100644 index 0000000..65048bf --- /dev/null +++ b/examples/functions/repeat3 @@ -0,0 +1,12 @@ +# From psamuels@jake.niar.twsu.edu (Peter Samuelson) +# posted to usenet, Message-ID: <6rtp8j$2a0$1@jake.niar.twsu.edu> + +repeat () +{ + local i max; # note that you can use \$i in the command string + max=$1; shift; + + i=1; while ((i <= max)); do + eval "$@"; ((i = i + 1)); + done; +} -- cgit v1.2.3