blob: 212e6ee97ff771c6dcb9e4b0fe5e6b5a5698fd8d (
plain) (
blame)
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
|
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en" />
<title>execline: the loopwhilex command</title>
<meta name="Description" content="execline: the loopwhilex command" />
<meta name="Keywords" content="execline command loopwhilex" />
<!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
</head>
<body>
<p>
<a href="index.html">execline</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>
<h1> The <tt>loopwhilex</tt> program </h1>
<p>
<tt>loopwhilex</tt> performs a conditional loop.
</p>
<h2> Interface </h2>
<pre>
loopwhilex [ -n ] [ -o <em>okcodes</em> | -x <em>breakcodes</em> ] <em>prog...</em>
</pre>
<ul>
<li> <tt>loopwhilex</tt> runs <em>prog...</em> as a child process and
waits for it to complete. </li>
<li> As long as <em>prog</em> exits zero, <tt>loopwhile</tt> runs it again. </li>
<li> <tt>loopwhilex</tt> then exits with an
<a href="exitcodes.html">approximation</a> of the last <em>prog</em>
invocation's exit code. </li>
</ul>
<h2> Options </h2>
<ul>
<li> <tt>-o</tt> <em>okcodes</em> : <em>okcodes</em> must
be a comma-separated list of exit codes. <tt>loopwhilex</tt> will keep
looping as long as <em>prog</em> exits with one of the codes in
<em>okcodes</em>. </li>
<li> <tt>-x</tt> <em>breakcodes</em> : like the previous
option, but with inverted meaning - the listed exit codes are codes
that will break the loop and exit, and the unlisted exit codes will keep
the loop running. </li>
<li> <tt>-n</tt> : negate the test. This option is now redundant,
and may disappear soon. </li>
</ul>
<h2> Notes </h2>
<ul>
<li> <tt>loopwhilex <em>prog</em>...</tt> is equivalent to <tt>loopwhilex -n -x 0 <em>prog...</em></tt>
and <tt>loopwhilex -o 0 <em>prog</em>...</tt> </li>
<li> Be careful: execline <strong>maintains no state</strong>, in particular it
uses <strong>no real variables</strong>, and environment will
be of no use here since every instance of <em>prog...</em> runs as a separate
child process. To avoid being stuck in an infinite loop, <em>prog...</em>
should modify some external state - for instance, the filesystem. </li>
</ul>
</body>
</html>
|