summaryrefslogtreecommitdiff
path: root/examples/functions/repeat3
blob: 65048bf912767e10ba847b4bed075255f94104b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
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;
}