The following reply was made to PR bin/68062; it has been noted by GNATS.
From: Jilles Tjoelker <[email protected]>
To: [email protected], [email protected]
Cc:
Subject: Re: bin/68062: standalone repeat(1) command
Date: Sun, 25 Apr 2010 23:18:13 +0200
I'm not sure if we want this repeat(1) command, given that csh(1)
already has it as a builtin and a simple shell function can do it in
sh(1).
repeat() {
local i="$1"
shift
while [ "$i" -gt 0 ]; do
"$@"
i=$((i-1))
done
}
This shell function will cause expansions and redirections to be
evaluated exactly once, but so do the csh builtin and your proposed
external command.
The closest to the repeat command that fits in sh's model is
ksh93/bash/zsh's arithmetic for command, e.g.
for ((i=0; i<3; i++)); do sync; done
I usually use the arithmetic for command or loops like in the shell
function above.
zsh also has a repeat compound command much like csh, except that it
will evaluate expansions and redirections for each execution of the
command.
--
Jilles Tjoelker
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"