aboutsummaryrefslogtreecommitdiff
path: root/rpt.1.in
blob: 6a0ef04845f559a22ee620fd310e1307330f6d14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
.\" Copyright (C), 2024  Tristan Riehs
.\" You may distribute this file under the terms of the GNU Free
.\" Documentation License.
.TH repeat 1 "2024-02-03" "repeat @VERSION@"
.SH NAME
repeat \- repeat a shell command
.SH SYNOPSIS
.TP
.B rpt
[
.B \-n
.I COUNT
] [
.B \-f
|
.B \-u
] [
.B \-p
]
.I COMMAND
.TP
.B rpt
[
.B \-h
|
.B \-v
]
.SH DESCRIPTION
.B rpt
allows you to easily repeat a command a certain number of times.
The command is repeated sequentially.
If stdin is not empty,
it is given to
.IR COMMAND .
.SH OPTIONS
.TP
.B \-h
Display help and exit.
.TP
.B \-v
Display version and exit.
.TP
.BR \-n \fICOUNT\fR
Repeat
.I COMMAND COUNT
times.
If this flag is not given,
.I COMMAND
is invoked once.
.TP
.B \-f
By default,
.B rpt
stops whenever
.I COMMAND
fails.
If the
.B force
flag is set,
.B rpt
ignores errors.
Icompatible with the
.B \-u
flag.
.TP
.B \-u
Repeat
.I COMMAND
until it fails.
Incompatible with the
.B \-f
flag.
Giving this option is equivalent to specifying
.B \-n
.IR LONG_MAX ,
where
.I LONG_MAX
is the maximum value a C99
.B long int
can hold, provided as a macro by
.BR limits.h (0p).
Therefore, the
.B \-u
and the
.B \-n
option suppress each other behavior.
.TP
.B \-p
Print the number of times
.I COMMAND
has been executed before exiting.
.SH "EXIT STATUS"
When a subprocess exit abnormally and the
.B force
flag is not given,
.B rpt
exits with the same status as the subprocess.
.TP
1
Invalid option.
.TP
2
Error while reading
.IR COUNT .
This includes the case where the
.B count
flag is given,
but
.I COUNT
is missing.
.TP
3
.I COMMAND
not provided.
.TP
4
Other error.
.SH FILES
None.
.SH "SEE ALSO"
.BR seq (1)
.BR test (1)
.SH BUGS
.SH AUTHOR
Tristan Riehs <tristan.riehs@bordeaux-inp.fr>