diff options
Diffstat (limited to 'devdocs/bash/job-control-builtins.html')
| -rw-r--r-- | devdocs/bash/job-control-builtins.html | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/devdocs/bash/job-control-builtins.html b/devdocs/bash/job-control-builtins.html new file mode 100644 index 00000000..de5c8470 --- /dev/null +++ b/devdocs/bash/job-control-builtins.html @@ -0,0 +1,33 @@ +<h1 class="section">Job Control Builtins</h1> <dl compact> <dt id="index-bg"><span><code>bg</code></span></dt> <dd> +<div class="example"> <pre class="example">bg [jobspec …] +</pre> +</div> <p>Resume each suspended job <var>jobspec</var> in the background, as if it had been started with ‘<samp>&</samp>’. If <var>jobspec</var> is not supplied, the current job is used. The return status is zero unless it is run when job control is not enabled, or, when run with job control enabled, any <var>jobspec</var> was not found or specifies a job that was started without job control. </p> </dd> <dt id="index-fg"><span><code>fg</code></span></dt> <dd> +<div class="example"> <pre class="example">fg [jobspec] +</pre> +</div> <p>Resume the job <var>jobspec</var> in the foreground and make it the current job. If <var>jobspec</var> is not supplied, the current job is used. The return status is that of the command placed into the foreground, or non-zero if run when job control is disabled or, when run with job control enabled, <var>jobspec</var> does not specify a valid job or <var>jobspec</var> specifies a job that was started without job control. </p> </dd> <dt id="index-jobs"><span><code>jobs</code></span></dt> <dd> +<div class="example"> <pre class="example">jobs [-lnprs] [jobspec] +jobs -x command [arguments] +</pre> +</div> <p>The first form lists the active jobs. The options have the following meanings: </p> <dl compact> <dt><span><code>-l</code></span></dt> <dd> +<p>List process <small>ID</small>s in addition to the normal information. </p> </dd> <dt><span><code>-n</code></span></dt> <dd> +<p>Display information only about jobs that have changed status since the user was last notified of their status. </p> </dd> <dt><span><code>-p</code></span></dt> <dd> +<p>List only the process <small>ID</small> of the job’s process group leader. </p> </dd> <dt><span><code>-r</code></span></dt> <dd> +<p>Display only running jobs. </p> </dd> <dt><span><code>-s</code></span></dt> <dd><p>Display only stopped jobs. </p></dd> </dl> <p>If <var>jobspec</var> is given, output is restricted to information about that job. If <var>jobspec</var> is not supplied, the status of all jobs is listed. </p> <p>If the <samp>-x</samp> option is supplied, <code>jobs</code> replaces any <var>jobspec</var> found in <var>command</var> or <var>arguments</var> with the corresponding process group <small>ID</small>, and executes <var>command</var>, passing it <var>argument</var>s, returning its exit status. </p> </dd> <dt id="index-kill"><span><code>kill</code></span></dt> <dd> +<div class="example"> <pre class="example">kill [-s sigspec] [-n signum] [-sigspec] jobspec or pid +kill -l|-L [exit_status] +</pre> +</div> <p>Send a signal specified by <var>sigspec</var> or <var>signum</var> to the process named by job specification <var>jobspec</var> or process <small>ID</small> <var>pid</var>. <var>sigspec</var> is either a case-insensitive signal name such as <code>SIGINT</code> (with or without the <code>SIG</code> prefix) or a signal number; <var>signum</var> is a signal number. If <var>sigspec</var> and <var>signum</var> are not present, <code>SIGTERM</code> is used. The <samp>-l</samp> option lists the signal names. If any arguments are supplied when <samp>-l</samp> is given, the names of the signals corresponding to the arguments are listed, and the return status is zero. <var>exit_status</var> is a number specifying a signal number or the exit status of a process terminated by a signal. The <samp>-L</samp> option is equivalent to <samp>-l</samp>. The return status is zero if at least one signal was successfully sent, or non-zero if an error occurs or an invalid option is encountered. </p> </dd> <dt id="index-wait"><span><code>wait</code></span></dt> <dd> +<div class="example"> <pre class="example">wait [-fn] [-p varname] [jobspec or pid …] +</pre> +</div> <p>Wait until the child process specified by each process <small>ID</small> <var>pid</var> or job specification <var>jobspec</var> exits and return the exit status of the last command waited for. If a job spec is given, all processes in the job are waited for. If no arguments are given, <code>wait</code> waits for all running background jobs and the last-executed process substitution, if its process id is the same as <var>$!</var>, and the return status is zero. If the <samp>-n</samp> option is supplied, <code>wait</code> waits for a single job from the list of <var>pid</var>s or <var>jobspec</var>s or, if no arguments are supplied, any job, to complete and returns its exit status. If none of the supplied arguments is a child of the shell, or if no arguments are supplied and the shell has no unwaited-for children, the exit status is 127. If the <samp>-p</samp> option is supplied, the process or job identifier of the job for which the exit status is returned is assigned to the variable <var>varname</var> named by the option argument. The variable will be unset initially, before any assignment. This is useful only when the <samp>-n</samp> option is supplied. Supplying the <samp>-f</samp> option, when job control is enabled, forces <code>wait</code> to wait for each <var>pid</var> or <var>jobspec</var> to terminate before returning its status, instead of returning when it changes status. If neither <var>jobspec</var> nor <var>pid</var> specifies an active child process of the shell, the return status is 127. If <code>wait</code> is interrupted by a signal, the return status will be greater than 128, as described above (see <a href="signals">Signals</a>). Otherwise, the return status is the exit status of the last process or job waited for. </p> </dd> <dt id="index-disown"><span><code>disown</code></span></dt> <dd> +<div class="example"> <pre class="example">disown [-ar] [-h] [jobspec … | pid … ] +</pre> +</div> <p>Without options, remove each <var>jobspec</var> from the table of active jobs. If the <samp>-h</samp> option is given, the job is not removed from the table, but is marked so that <code>SIGHUP</code> is not sent to the job if the shell receives a <code>SIGHUP</code>. If <var>jobspec</var> is not present, and neither the <samp>-a</samp> nor the <samp>-r</samp> option is supplied, the current job is used. If no <var>jobspec</var> is supplied, the <samp>-a</samp> option means to remove or mark all jobs; the <samp>-r</samp> option without a <var>jobspec</var> argument restricts operation to running jobs. </p> </dd> <dt id="index-suspend"><span><code>suspend</code></span></dt> <dd> +<div class="example"> <pre class="example">suspend [-f] +</pre> +</div> <p>Suspend the execution of this shell until it receives a <code>SIGCONT</code> signal. A login shell, or a shell without job control enabled, cannot be suspended; the <samp>-f</samp> option can be used to override this and force the suspension. The return status is 0 unless the shell is a login shell or job control is not enabled and <samp>-f</samp> is not supplied. </p> </dd> </dl> <p>When job control is not active, the <code>kill</code> and <code>wait</code> builtins do not accept <var>jobspec</var> arguments. They must be supplied process <small>ID</small>s. </p><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>Licensed under the GNU Free Documentation License.<br> + <a href="https://www.gnu.org/software/bash/manual/html_node/Job-Control-Builtins.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/Job-Control-Builtins.html</a> + </p> +</div> |
