summaryrefslogtreecommitdiff
path: root/doc/forx.html
blob: 0ed4799ab0da363e8c9c935873ea4f3577b50cd5 (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
<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta http-equiv="Content-Language" content="en" />
  <title>execline: the forx command</title>
  <meta name="Description" content="execline: the forx command" />
  <meta name="Keywords" content="execline command forx" />
  <!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> -->
 </head>
<body>

<p>
<a href="index.html">execline</a><br />
<a href="http://skarnet.org/software/">Software</a><br />
<a href="http://skarnet.org/">skarnet.org</a>
</p>

<h1> The <tt>forx</tt> program </h1>

<p>
<tt>forx</tt> runs a loop.
</p>

<h2> Interface </h2>

<p>
 In an <a href="execlineb.html">execlineb</a> script:
</p>

<pre>
     forx [ -p | -o <em>okcodes</em> | -x <em>breakcodes</em> ] <em>variable</em> { <em>args...</em> } <em>loop...</em>
</pre>

<ul>
 <li> <tt>forx</tt> reads a
<a href="el_semicolon.html">block</a> and unquotes it.
That block contains a list of <em>args</em>. </li>
 <li> For each argument <em>x</em> in <em>args...</em>,
<tt>forx</tt> runs <em>loop</em> as a child process, with
<em>variable</em>=<em>x</em> added to its environment. </li>
 <li> <tt>forx</tt> then exits 0. </li>
</ul>

<h2> Options </h2>

<ul>
 <li> <tt>-p</tt>&nbsp;: run in parallel. Do not wait for an instance of
<em>loop...</em> to exit before spawning the next one. <tt>forx</tt>
will still wait for all instances of <em>loop</em> to terminate before
exiting, though. </li>
 <li> <tt>-o</tt>&nbsp;<em>okcodes</em>&nbsp;: <em>okcodes</em> must
be a comma-separated list of exit codes. If the <tt>-p</tt> flag
hasn't been given and <em>loop</em> exits with one of the codes in
<em>okcodes</em>,
forx will run the following instances of the loop, but if the exit code is
not listed in <em>okcodes</em>, forx will exit immediately with an
<a href="exitcodes.html">approximation</a> of the same exit code. </li>
 <li> <tt>-x</tt>&nbsp;<em>breakcodes</em>&nbsp;: like the previous
option, but with inverted meaning - the listed exit codes are codes
that will make forx break the loop and exit, and the unlisted exit
codes will make it keep looping. </li>
</ul>

<h2> Notes </h2>

<ul>
 <li> You can start <em>loop</em> with "import -u <em>variable</em>"
if you want variable substitution. </li>
</ul>

</body>
</html>