Bug 68062

Summary: standalone repeat(1) command
Product: Base System Reporter: Cyrille Lefevre <cyrille.lefevre>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.2-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.shar none

Description Cyrille Lefevre 2004-06-18 00:10:26 UTC
	the standalone repeat(1) utility inpired from the csh(1) one.

How-To-Repeat: 	repeat 3 sync
Comment 1 Jilles Tjoelker freebsd_committer freebsd_triage 2010-04-25 22:18:13 UTC
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
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:48 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped