Un outil pour savoir si une commande est posix - retour accueil
git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |
bg.html (13190B)
1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved --> 2 <!DOCTYPE HTML> 3 <html lang="en"> 4 <head> 5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0"> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 --> 8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved --> 9 <title>bg</title> 10 </head> 11 <body bgcolor="white"> 12 <div class="NAVHEADER"> 13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 14 <tr class="nav"> 15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/bc.html" accesskey="P"><<< 16 Previous</a></td> 17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/c17.html" accesskey="N">Next >>></a></td> 19 </tr> 20 </table> 21 <hr align="left" width="100%"></div> 22 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> 23 <center><font size="2">The Open Group Base Specifications Issue 8<br> 24 IEEE Std 1003.1-2024<br> 25 Copyright © 2001-2024 The IEEE and The Open Group</font></center> 26 <hr size="2" noshade> 27 <a name="top" id="top"></a> <a name="bg" id="bg"></a> <a name="tag_20_10" id="tag_20_10"></a><!-- bg --> 28 <h4 class="mansect"><a name="tag_20_10_01" id="tag_20_10_01"></a>NAME</h4> 29 <blockquote>bg — run jobs in the background</blockquote> 30 <h4 class="mansect"><a name="tag_20_10_02" id="tag_20_10_02"></a>SYNOPSIS</h4> 31 <blockquote class="synopsis"> 32 <div class="box"><code><tt><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt= 33 "[Option Start]" border="0"> bg</tt> <b>[</b><i>job_id</i><tt>...</tt><b>]</b> <tt><img src="../images/opt-end.gif" alt= 34 "[Option End]" border="0"></tt></code></div> 35 </blockquote> 36 <h4 class="mansect"><a name="tag_20_10_03" id="tag_20_10_03"></a>DESCRIPTION</h4> 37 <blockquote> 38 <p>If job control is enabled (see the description of <a href="../utilities/V3_chap02.html#set"><i>set</i></a> <b>-m</b>), the shell 39 is interactive, and the current shell execution environment (see <a href="../utilities/V3_chap02.html#tag_19_13"><i>2.13 Shell 40 Execution Environment</i></a> ) is not a subshell environment, the <i>bg</i> utility shall resume suspended jobs from the current 41 shell execution environment by running them as background jobs, as described in <a href= 42 "../utilities/V3_chap02.html#tag_19_11"><i>2.11 Job Control</i></a> ; it may also do so if the shell is non-interactive or the 43 current shell execution environment is a subshell environment. If the job specified by <i>job_id</i> is already a running 44 background job, the <i>bg</i> utility shall have no effect and shall exit successfully.</p> 45 </blockquote> 46 <h4 class="mansect"><a name="tag_20_10_04" id="tag_20_10_04"></a>OPTIONS</h4> 47 <blockquote> 48 <p>None.</p> 49 </blockquote> 50 <h4 class="mansect"><a name="tag_20_10_05" id="tag_20_10_05"></a>OPERANDS</h4> 51 <blockquote> 52 <p>The following operand shall be supported:</p> 53 <dl compact> 54 <dd></dd> 55 <dt><i>job_id</i></dt> 56 <dd>Specify the job to be resumed as a background job. If no <i>job_id</i> operand is given, the most recently suspended job shall 57 be used. The format of <i>job_id</i> is described in XBD <a href="../basedefs/V1_chap03.html#tag_03_182"><i>3.182 Job ID</i></a> 58 .</dd> 59 </dl> 60 </blockquote> 61 <h4 class="mansect"><a name="tag_20_10_06" id="tag_20_10_06"></a>STDIN</h4> 62 <blockquote> 63 <p>Not used.</p> 64 </blockquote> 65 <h4 class="mansect"><a name="tag_20_10_07" id="tag_20_10_07"></a>INPUT FILES</h4> 66 <blockquote> 67 <p>None.</p> 68 </blockquote> 69 <h4 class="mansect"><a name="tag_20_10_08" id="tag_20_10_08"></a>ENVIRONMENT VARIABLES</h4> 70 <blockquote> 71 <p>The following environment variables shall affect the execution of <i>bg</i>:</p> 72 <dl compact> 73 <dd></dd> 74 <dt><i>LANG</i></dt> 75 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href= 76 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization 77 variables used to determine the values of locale categories.)</dd> 78 <dt><i>LC_ALL</i></dt> 79 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd> 80 <dt><i>LC_CTYPE</i></dt> 81 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as 82 opposed to multi-byte characters in arguments).</dd> 83 <dt><i>LC_MESSAGES</i></dt> 84 <dd><br> 85 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd> 86 <dt><i>NLSPATH</i></dt> 87 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 88 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border= 89 "0"></dd> 90 </dl> 91 </blockquote> 92 <h4 class="mansect"><a name="tag_20_10_09" id="tag_20_10_09"></a>ASYNCHRONOUS EVENTS</h4> 93 <blockquote> 94 <p>Default.</p> 95 </blockquote> 96 <h4 class="mansect"><a name="tag_20_10_10" id="tag_20_10_10"></a>STDOUT</h4> 97 <blockquote> 98 <p>The output of <i>bg</i> shall consist of a line in the format:</p> 99 <pre> 100 <tt>"[%d] %s\n", <</tt><i>job-number</i><tt>>, <</tt><i>command</i><tt>> 101 </tt></pre> 102 <p>where the fields are as follows:</p> 103 <dl compact> 104 <dd></dd> 105 <dt><<i>job-number</i>></dt> 106 <dd>A number that can be used to identify the job to the <a href="../utilities/wait.html"><i>wait</i></a>, <a href= 107 "../utilities/fg.html"><i>fg</i></a>, and <a href="../utilities/kill.html"><i>kill</i></a> utilities. Using these utilities, the 108 job can be identified by prefixing the job number with <tt>'%'</tt>.</dd> 109 <dt><<i>command</i>></dt> 110 <dd>The associated command that was given to the shell.</dd> 111 </dl> 112 </blockquote> 113 <h4 class="mansect"><a name="tag_20_10_11" id="tag_20_10_11"></a>STDERR</h4> 114 <blockquote> 115 <p>The standard error shall be used only for diagnostic messages.</p> 116 </blockquote> 117 <h4 class="mansect"><a name="tag_20_10_12" id="tag_20_10_12"></a>OUTPUT FILES</h4> 118 <blockquote> 119 <p>None.</p> 120 </blockquote> 121 <h4 class="mansect"><a name="tag_20_10_13" id="tag_20_10_13"></a>EXTENDED DESCRIPTION</h4> 122 <blockquote> 123 <p>None.</p> 124 </blockquote> 125 <h4 class="mansect"><a name="tag_20_10_14" id="tag_20_10_14"></a>EXIT STATUS</h4> 126 <blockquote> 127 <p>The following exit values shall be returned:</p> 128 <dl compact> 129 <dd></dd> 130 <dt> 0</dt> 131 <dd>Successful completion.</dd> 132 <dt>>0</dt> 133 <dd>An error occurred.</dd> 134 </dl> 135 </blockquote> 136 <h4 class="mansect"><a name="tag_20_10_15" id="tag_20_10_15"></a>CONSEQUENCES OF ERRORS</h4> 137 <blockquote> 138 <p>If job control is disabled, the <i>bg</i> utility shall exit with an error and no job shall be placed in the background.</p> 139 </blockquote> 140 <hr> 141 <div class="box"><em>The following sections are informative.</em></div> 142 <h4 class="mansect"><a name="tag_20_10_16" id="tag_20_10_16"></a>APPLICATION USAGE</h4> 143 <blockquote> 144 <p>This utility is required to be intrinsic. See <a href="../utilities/V3_chap01.html#tag_18_07"><i>1.7 Intrinsic Utilities</i></a> 145 for details.</p> 146 <p>A job is generally suspended by typing the SUSP character (<control>-Z on most systems); see XBD <a href= 147 "../basedefs/V1_chap11.html#tag_11"><i>11. General Terminal Interface</i></a> . At that point, <i>bg</i> can put the job into the 148 background. This is most effective when the job is expecting no terminal input and its output has been redirected to non-terminal 149 files. A background job can be forced to stop when it has terminal output by issuing the command:</p> 150 <pre> 151 <tt>stty tostop 152 </tt></pre> 153 <p>A background job can be stopped with the command:</p> 154 <pre> 155 <tt>kill -s stop </tt><i>job ID</i><tt> 156 </tt></pre> 157 <p>The <i>bg</i> utility does not work as expected when it is operating in its own utility execution environment because that 158 environment has no suspended jobs. In the following examples:</p> 159 <pre> 160 <tt>... | xargs bg 161 (bg) 162 </tt></pre> 163 <p>each <i>bg</i> operates in a different environment and does not share its parent shell's understanding of jobs. For this reason, 164 <i>bg</i> is generally implemented as a shell regular built-in.</p> 165 </blockquote> 166 <h4 class="mansect"><a name="tag_20_10_17" id="tag_20_10_17"></a>EXAMPLES</h4> 167 <blockquote> 168 <p>None.</p> 169 </blockquote> 170 <h4 class="mansect"><a name="tag_20_10_18" id="tag_20_10_18"></a>RATIONALE</h4> 171 <blockquote> 172 <p>The extensions to the shell specified in this volume of POSIX.1-2024 have mostly been based on features provided by the 173 KornShell. The job control features provided by <i>bg</i>, <a href="../utilities/fg.html"><i>fg</i></a>, and <a href= 174 "../utilities/jobs.html"><i>jobs</i></a> are also based on the KornShell. The standard developers examined the characteristics of 175 the C shell versions of these utilities and found that differences exist. Despite widespread use of the C shell, the KornShell 176 versions were selected for this volume of POSIX.1-2024 to maintain a degree of uniformity with the rest of the KornShell features 177 selected (such as the very popular command line editing features).</p> 178 <p>The <i>bg</i> utility is expected to wrap its output if the output exceeds the number of display columns.</p> 179 <p>The <i>bg</i> and <a href="../utilities/fg.html"><i>fg</i></a> utilities are not symmetric as regards the list of process IDs 180 known in the current shell execution environment. Whereas <a href="../utilities/fg.html"><i>fg</i></a> removes a process ID from 181 this list, <i>bg</i> has no need to add one to this list when it resumes execution of a suspended job in the background, because 182 this has already been done by the shell when the suspended background job was created (see <a href= 183 "../utilities/V3_chap02.html#tag_19_11"><i>2.11 Job Control</i></a> ).</p> 184 </blockquote> 185 <h4 class="mansect"><a name="tag_20_10_19" id="tag_20_10_19"></a>FUTURE DIRECTIONS</h4> 186 <blockquote> 187 <p>None.</p> 188 </blockquote> 189 <h4 class="mansect"><a name="tag_20_10_20" id="tag_20_10_20"></a>SEE ALSO</h4> 190 <blockquote> 191 <p><a href="../utilities/V3_chap02.html#tag_19_09_03_02"><i>2.9.3.1 Asynchronous AND-OR Lists</i></a> , <a href= 192 "../utilities/fg.html#"><i>fg</i></a> , <a href="../utilities/kill.html#tag_20_64"><i>kill</i></a> , <a href= 193 "../utilities/jobs.html#"><i>jobs</i></a> , <a href="../utilities/wait.html#tag_20_147"><i>wait</i></a></p> 194 <p>XBD <a href="../basedefs/V1_chap03.html#tag_03_182"><i>3.182 Job ID</i></a> , <a href="../basedefs/V1_chap08.html#tag_08"><i>8. 195 Environment Variables</i></a> , <a href="../basedefs/V1_chap11.html#tag_11"><i>11. General Terminal Interface</i></a></p> 196 </blockquote> 197 <h4 class="mansect"><a name="tag_20_10_21" id="tag_20_10_21"></a>CHANGE HISTORY</h4> 198 <blockquote> 199 <p>First released in Issue 4.</p> 200 </blockquote> 201 <h4 class="mansect"><a name="tag_20_10_22" id="tag_20_10_22"></a>Issue 6</h4> 202 <blockquote> 203 <p>This utility is marked as part of the User Portability Utilities option.</p> 204 <p>The JC margin marker on the SYNOPSIS is removed since support for Job Control is mandatory in this version. This is a FIPS 205 requirement.</p> 206 </blockquote> 207 <h4 class="mansect"><a name="tag_20_10_23" id="tag_20_10_23"></a>Issue 7</h4> 208 <blockquote> 209 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p> 210 </blockquote> 211 <h4 class="mansect"><a name="tag_20_10_24" id="tag_20_10_24"></a>Issue 8</h4> 212 <blockquote> 213 <p>Austin Group Defect 854 is applied, adding a note to the APPLICATION USAGE section that this utility is required to be 214 intrinsic.</p> 215 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p> 216 <p>Austin Group Defect 1254 is applied, updating the DESCRIPTION to account for the addition of <a href= 217 "../utilities/V3_chap02.html#tag_19_11"><i>2.11 Job Control</i></a> and adding a paragraph to RATIONALE.</p> 218 </blockquote> 219 <div class="box"><em>End of informative text.</em></div> 220 <hr> 221 <p> </p> 222 <a href="#top"><span class="topOfPage">return to top of page</span></a><br> 223 <hr size="2" noshade> 224 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br> 225 POSIX™ is a Trademark of The IEEE.<br> 226 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br> 227 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href= 228 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a> 229 ]</font></center> 230 <hr size="2" noshade> 231 <div class="NAVHEADER"> 232 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 233 <tr class="nav"> 234 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/bc.html" accesskey="P"><<< 235 Previous</a></td> 236 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 237 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/c17.html" accesskey="N">Next >>></a></td> 238 </tr> 239 </table> 240 <hr align="left" width="100%"></div> 241 </body> 242 </html>