summaryrefslogtreecommitdiff
path: root/doc/foreground.html
blob: b7cf9066e852e28869aa7295d3acf94c258b30b6 (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
<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 &semi; command</title>
  <meta name="Description" content="execline: the &semi; command" />
  <meta name="Keywords" content="execline command &semi;" />
  <!-- <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>&semi;</tt> program </h1>

<p>
<tt>&semi;/tt> executes a sequence of commands.
</p>

<h2> Interface </h2>

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

<pre>
     &semi; { <em>prog1...</em> } <em>prog2...</em>
</pre>

<ul>
 <li> <tt>&semi;</tt> reads <em>prog1</em> in a
<a href="el_semicolon.html">block</a>. It forks and
executes it, then waits for it to complete. </li>
 <li> <tt>&semi;</tt> sets the <tt>?</tt> environment
variable to the exit code of <em>prog1</em>. If <em>prog1...</em>
was killed by a signal, the <tt>?</tt> value is 256 plus the signal
number. </li>
 <li> <tt>&semi;</tt> then execs into <em>prog2...</em>. </li>
</ul>

<h2> Notes </h2>

<ul>
 <li> <tt>&semi;</tt> is the basic sequence operator: it takes two
commands and executes them one by one. execline scripts require it to
wrap external commands that exit instead of natively supporting the
"perform some action, then execute some other program" model. </li>
 <li> <tt>&semi; <em>prog1...</em> "" <em>prog2...</em></tt> is
equivalent to <tt>sh -c '<em>prog1...</em> ; exec <em>prog2...</em>'</tt>.
 </li>
 <li> 256 and above are not valid exit codes for commands, so when the
<tt>?</tt> environment variable contains 256 or more, it means that the
previous command was killed by a signal. There is no ambiguity here, and
<tt>?</tt> reports exactly what happened to the previous command;
<tt>&semi;</tt> does not exit, so there is no need for
<a href="exitcodes.html">exit code approximation</a>. </li>
</ul>

</body>
</html>