logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

bg.1p (6503B)


  1. '\" et
  2. .TH BG "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. bg
  12. \(em run jobs in the background
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. bg \fB[\fIjob_id\fR...\fB]\fR
  17. .fi
  18. .SH DESCRIPTION
  19. If job control is enabled (see the description of
  20. .IR set
  21. .BR \-m ),
  22. the
  23. .IR bg
  24. utility shall resume suspended jobs from the current environment (see
  25. .IR "Section 2.12" ", " "Shell Execution Environment")
  26. by running them as background jobs. If the job specified by
  27. .IR job_id
  28. is already a running background job, the
  29. .IR bg
  30. utility shall have no effect and shall exit successfully.
  31. .P
  32. Using
  33. .IR bg
  34. to place a job into the background shall cause its process ID to become
  35. ``known in the current shell execution environment'', as if it had been
  36. started as an asynchronous list; see
  37. .IR "Section 2.9.3.1" ", " "Examples".
  38. .SH OPTIONS
  39. None.
  40. .SH OPERANDS
  41. The following operand shall be supported:
  42. .IP "\fIjob_id\fR" 10
  43. Specify the job to be resumed as a background job. If no
  44. .IR job_id
  45. operand is given, the most recently suspended job shall be used. The
  46. format of
  47. .IR job_id
  48. is described in the Base Definitions volume of POSIX.1\(hy2017,
  49. .IR "Section 3.204" ", " "Job Control Job ID".
  50. .SH STDIN
  51. Not used.
  52. .SH "INPUT FILES"
  53. None.
  54. .SH "ENVIRONMENT VARIABLES"
  55. The following environment variables shall affect the execution of
  56. .IR bg :
  57. .IP "\fILANG\fP" 10
  58. Provide a default value for the internationalization variables that are
  59. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  60. .IR "Section 8.2" ", " "Internationalization Variables"
  61. for the precedence of internationalization variables used to determine
  62. the values of locale categories.)
  63. .IP "\fILC_ALL\fP" 10
  64. If set to a non-empty string value, override the values of all the
  65. other internationalization variables.
  66. .IP "\fILC_CTYPE\fP" 10
  67. Determine the locale for the interpretation of sequences of bytes of
  68. text data as characters (for example, single-byte as opposed to
  69. multi-byte characters in arguments).
  70. .IP "\fILC_MESSAGES\fP" 10
  71. .br
  72. Determine the locale that should be used to affect the format and
  73. contents of diagnostic messages written to standard error.
  74. .IP "\fINLSPATH\fP" 10
  75. Determine the location of message catalogs for the processing of
  76. .IR LC_MESSAGES .
  77. .SH "ASYNCHRONOUS EVENTS"
  78. Default.
  79. .SH STDOUT
  80. The output of
  81. .IR bg
  82. shall consist of a line in the format:
  83. .sp
  84. .RS 4
  85. .nf
  86. "[%d] %s\en", <\fIjob-number\fR>, <\fIcommand\fR>
  87. .fi
  88. .P
  89. .RE
  90. .P
  91. where the fields are as follows:
  92. .IP "<\fIjob-number\fR>" 10
  93. A number that can be used to identify the job to the
  94. .IR wait ,
  95. .IR fg ,
  96. and
  97. .IR kill
  98. utilities. Using these utilities, the job can be identified by
  99. prefixing the job number with
  100. .BR '%' .
  101. .IP "<\fIcommand\fR>" 10
  102. The associated command that was given to the shell.
  103. .SH STDERR
  104. The standard error shall be used only for diagnostic messages.
  105. .SH "OUTPUT FILES"
  106. None.
  107. .SH "EXTENDED DESCRIPTION"
  108. None.
  109. .SH "EXIT STATUS"
  110. The following exit values shall be returned:
  111. .IP "\00" 6
  112. Successful completion.
  113. .IP >0 6
  114. An error occurred.
  115. .SH "CONSEQUENCES OF ERRORS"
  116. If job control is disabled, the
  117. .IR bg
  118. utility shall exit with an error and no job shall be placed in the
  119. background.
  120. .LP
  121. .IR "The following sections are informative."
  122. .SH "APPLICATION USAGE"
  123. A job is generally suspended by typing the SUSP character
  124. (<control>\(hyZ on most systems); see the Base Definitions volume of POSIX.1\(hy2017,
  125. .IR "Chapter 11" ", " "General Terminal Interface".
  126. At that point,
  127. .IR bg
  128. can put the job into the background. This is most effective when the
  129. job is expecting no terminal input and its output has been redirected
  130. to non-terminal files. A background job can be forced to stop when it
  131. has terminal output by issuing the command:
  132. .sp
  133. .RS 4
  134. .nf
  135. stty tostop
  136. .fi
  137. .P
  138. .RE
  139. .P
  140. A background job can be stopped with the command:
  141. .sp
  142. .RS 4
  143. .nf
  144. kill -s stop \fIjob ID\fR
  145. .fi
  146. .P
  147. .RE
  148. .P
  149. The
  150. .IR bg
  151. utility does not work as expected when it is operating in its own
  152. utility execution environment because that environment has no suspended
  153. jobs. In the following examples:
  154. .sp
  155. .RS 4
  156. .nf
  157. \&... | xargs bg
  158. (bg)
  159. .fi
  160. .P
  161. .RE
  162. .P
  163. each
  164. .IR bg
  165. operates in a different environment and does not share its parent
  166. shell's understanding of jobs. For this reason,
  167. .IR bg
  168. is generally implemented as a shell regular built-in.
  169. .SH EXAMPLES
  170. None.
  171. .SH RATIONALE
  172. The extensions to the shell specified in this volume of POSIX.1\(hy2017 have mostly been based
  173. on features provided by the KornShell. The job control features
  174. provided by
  175. .IR bg ,
  176. .IR fg ,
  177. and
  178. .IR jobs
  179. are also based on the KornShell. The standard developers examined the
  180. characteristics of the C shell versions of these utilities and found
  181. that differences exist. Despite widespread use of the C shell, the
  182. KornShell versions were selected for this volume of POSIX.1\(hy2017 to maintain a degree of
  183. uniformity with the rest of the KornShell features selected (such as
  184. the very popular command line editing features).
  185. .P
  186. The
  187. .IR bg
  188. utility is expected to wrap its output if the output exceeds the number
  189. of display columns.
  190. .SH "FUTURE DIRECTIONS"
  191. None.
  192. .SH "SEE ALSO"
  193. .IR "Section 2.9.3.1" ", " "Examples",
  194. .IR "\fIfg\fR\^",
  195. .IR "\fIkill\fR\^",
  196. .IR "\fIjobs\fR\^",
  197. .IR "\fIwait\fR\^"
  198. .P
  199. The Base Definitions volume of POSIX.1\(hy2017,
  200. .IR "Section 3.204" ", " "Job Control Job ID",
  201. .IR "Chapter 8" ", " "Environment Variables",
  202. .IR "Chapter 11" ", " "General Terminal Interface"
  203. .\"
  204. .SH COPYRIGHT
  205. Portions of this text are reprinted and reproduced in electronic form
  206. from IEEE Std 1003.1-2017, Standard for Information Technology
  207. -- Portable Operating System Interface (POSIX), The Open Group Base
  208. Specifications Issue 7, 2018 Edition,
  209. Copyright (C) 2018 by the Institute of
  210. Electrical and Electronics Engineers, Inc and The Open Group.
  211. In the event of any discrepancy between this version and the original IEEE and
  212. The Open Group Standard, the original IEEE and The Open Group Standard
  213. is the referee document. The original Standard can be obtained online at
  214. http://www.opengroup.org/unix/online.html .
  215. .PP
  216. Any typographical or formatting errors that appear
  217. in this page are most likely
  218. to have been introduced during the conversion of the source files to
  219. man page format. To report such errors, see
  220. https://www.kernel.org/doc/man-pages/reporting_bugs.html .