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

exec.1p (3940B)


  1. '\" et
  2. .TH EXEC "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. exec
  12. \(em execute commands and open, close, or copy file descriptors
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. exec \fB[\fIcommand \fB[\fIargument\fR...\fB]]\fR
  17. .fi
  18. .SH DESCRIPTION
  19. The
  20. .IR exec
  21. utility shall open, close, and/or copy file descriptors as specified by
  22. any redirections as part of the command.
  23. .P
  24. If
  25. .IR exec
  26. is specified without
  27. .IR command
  28. or
  29. .IR argument s,
  30. and any file descriptors with numbers greater than 2 are opened with
  31. associated redirection statements, it is unspecified whether those file
  32. descriptors remain open when the shell invokes another utility.
  33. Scripts concerned that child shells could misuse open file descriptors
  34. can always close them explicitly, as shown in one of the following
  35. examples.
  36. .P
  37. If
  38. .IR exec
  39. is specified with
  40. .IR command ,
  41. it shall replace the shell with
  42. .IR command
  43. without creating a new process. If
  44. .IR argument s
  45. are specified, they shall be arguments to
  46. .IR command .
  47. Redirection affects the current shell execution environment.
  48. .SH OPTIONS
  49. None.
  50. .SH OPERANDS
  51. See the DESCRIPTION.
  52. .SH STDIN
  53. Not used.
  54. .SH "INPUT FILES"
  55. None.
  56. .SH "ENVIRONMENT VARIABLES"
  57. None.
  58. .SH "ASYNCHRONOUS EVENTS"
  59. Default.
  60. .SH STDOUT
  61. Not used.
  62. .SH STDERR
  63. The standard error shall be used only for diagnostic messages.
  64. .SH "OUTPUT FILES"
  65. None.
  66. .SH "EXTENDED DESCRIPTION"
  67. None.
  68. .SH "EXIT STATUS"
  69. If
  70. .IR command
  71. is specified,
  72. .IR exec
  73. shall not return to the shell; rather, the exit status of the process
  74. shall be the exit status of the program implementing
  75. .IR command ,
  76. which overlaid the shell. If
  77. .IR command
  78. is not found, the exit status shall be 127. If
  79. .IR command
  80. is found, but it is not an executable utility, the exit status shall be
  81. 126. If a redirection error occurs (see
  82. .IR "Section 2.8.1" ", " "Consequences of Shell Errors"),
  83. the shell shall exit with a value in the range 1\-125. Otherwise,
  84. .IR exec
  85. shall return a zero exit status.
  86. .SH "CONSEQUENCES OF ERRORS"
  87. Default.
  88. .LP
  89. .IR "The following sections are informative."
  90. .SH "APPLICATION USAGE"
  91. None.
  92. .SH EXAMPLES
  93. Open
  94. .IR readfile
  95. as file descriptor 3 for reading:
  96. .sp
  97. .RS 4
  98. .nf
  99. exec 3< readfile
  100. .fi
  101. .P
  102. .RE
  103. .P
  104. Open
  105. .IR writefile
  106. as file descriptor 4 for writing:
  107. .sp
  108. .RS 4
  109. .nf
  110. exec 4> writefile
  111. .fi
  112. .P
  113. .RE
  114. .P
  115. Make file descriptor 5 a copy of file descriptor 0:
  116. .sp
  117. .RS 4
  118. .nf
  119. exec 5<&0
  120. .fi
  121. .P
  122. .RE
  123. .P
  124. Close file descriptor 3:
  125. .sp
  126. .RS 4
  127. .nf
  128. exec 3<&-
  129. .fi
  130. .P
  131. .RE
  132. .P
  133. Cat the file
  134. .BR maggie
  135. by replacing the current shell with the
  136. .IR cat
  137. utility:
  138. .sp
  139. .RS 4
  140. .nf
  141. exec cat maggie
  142. .fi
  143. .P
  144. .RE
  145. .SH "RATIONALE"
  146. Most historical implementations were not conformant in that:
  147. .sp
  148. .RS 4
  149. .nf
  150. foo=bar exec cmd
  151. .fi
  152. .P
  153. .RE
  154. .P
  155. did not pass
  156. .BR foo
  157. to
  158. .BR cmd .
  159. .SH "FUTURE DIRECTIONS"
  160. None.
  161. .SH "SEE ALSO"
  162. .IR "Section 2.14" ", " "Special Built-In Utilities"
  163. .\"
  164. .SH COPYRIGHT
  165. Portions of this text are reprinted and reproduced in electronic form
  166. from IEEE Std 1003.1-2017, Standard for Information Technology
  167. -- Portable Operating System Interface (POSIX), The Open Group Base
  168. Specifications Issue 7, 2018 Edition,
  169. Copyright (C) 2018 by the Institute of
  170. Electrical and Electronics Engineers, Inc and The Open Group.
  171. In the event of any discrepancy between this version and the original IEEE and
  172. The Open Group Standard, the original IEEE and The Open Group Standard
  173. is the referee document. The original Standard can be obtained online at
  174. http://www.opengroup.org/unix/online.html .
  175. .PP
  176. Any typographical or formatting errors that appear
  177. in this page are most likely
  178. to have been introduced during the conversion of the source files to
  179. man page format. To report such errors, see
  180. https://www.kernel.org/doc/man-pages/reporting_bugs.html .