blob: 8656b04a8c5e60179da7f1f67307c24acf02654f (
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
|
<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 background command</title>
<meta name="Description" content="execline: the background command" />
<meta name="Keywords" content="execline command background" />
<!-- <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>background</tt> program </h1>
<tt>background</tt> launches a command in the background, then goes on
with the execution flow.
<h2> Interface </h2>
<p>
In an <a href="execlineb.html">execlineb</a> script:
</p>
<pre>
background [ -d ] { <em>prog1...</em> } <em>prog2...</em>
</pre>
<ul>
<li> <tt>background</tt> reads a <em>prog1...</em> command in a
<a href="el_semicolon.html">block</a> and unquotes it. </li>
<li> It spawns a child executing <em>prog1...</em>. </li>
<li> It sets the <tt>!</tt> environment
variable to the pid of the <em>prog1...</em> process. </li>
<li> It then execs into <em>prog2...</em>. </li>
</ul>
<h2> Options </h2>
<ul>
<li> <tt>-d</tt> : doublefork. If the <tt>-d</tt> option is set,
<em>prog1...</em> will run as a grandchild of <tt>background</tt>. </li>
</ul>
<h2> Notes </h2>
<ul>
<li> <tt>background <em>prog1...</em> "" <em>prog2...</em></tt> is
equivalent to <tt>sh -c '<em>prog1...</em> & ; exec <em>prog2...</em>'</tt>. </li>
</ul>
</body>
</html>
|