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

export.1p (4909B)


  1. '\" et
  2. .TH EXPORT "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. export
  12. \(em set the export attribute for variables
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. export name\fB[\fR=\fIword\fB]\fR...
  17. .P
  18. export\fR -p
  19. .fi
  20. .SH DESCRIPTION
  21. The shell shall give the
  22. .IR export
  23. attribute to the variables corresponding to the specified
  24. .IR name s,
  25. which shall cause them to be in the environment of subsequently
  26. executed commands. If the name of a variable is followed by =\c
  27. .IR word ,
  28. then the value of that variable shall be set to
  29. .IR word .
  30. .P
  31. The
  32. .IR export
  33. special built-in shall support the Base Definitions volume of POSIX.1\(hy2017,
  34. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  35. .P
  36. When
  37. .BR \-p
  38. is specified,
  39. .IR export
  40. shall write to the standard output the names and values of all exported
  41. variables, in the following format:
  42. .sp
  43. .RS 4
  44. .nf
  45. "export %s=%s\en", <\fIname\fR>, <\fIvalue\fR>
  46. .fi
  47. .P
  48. .RE
  49. .P
  50. if
  51. .IR name
  52. is set, and:
  53. .sp
  54. .RS 4
  55. .nf
  56. "export %s\en", <\fIname\fR>
  57. .fi
  58. .P
  59. .RE
  60. .P
  61. if
  62. .IR name
  63. is unset.
  64. .P
  65. The shell shall format the output, including the proper use of quoting,
  66. so that it is suitable for reinput to the shell as commands that
  67. achieve the same exporting results, except:
  68. .IP " 1." 4
  69. Read-only variables with values cannot be reset.
  70. .IP " 2." 4
  71. Variables that were unset at the time they were output need not be
  72. reset to the unset state if a value is assigned to the variable between
  73. the time the state was saved and the time at which the saved output is
  74. reinput to the shell.
  75. .P
  76. When no arguments are given, the results are unspecified.
  77. .SH OPTIONS
  78. See the DESCRIPTION.
  79. .SH OPERANDS
  80. See the DESCRIPTION.
  81. .SH STDIN
  82. Not used.
  83. .SH "INPUT FILES"
  84. None.
  85. .SH "ENVIRONMENT VARIABLES"
  86. None.
  87. .SH "ASYNCHRONOUS EVENTS"
  88. Default.
  89. .SH STDOUT
  90. See the DESCRIPTION.
  91. .SH STDERR S
  92. The standard error shall be used only for diagnostic messages.
  93. .SH "OUTPUT FILES"
  94. None.
  95. .SH "EXTENDED DESCRIPTION"
  96. None.
  97. .SH "EXIT STATUS"
  98. .IP "\00" 6
  99. All
  100. .IR name
  101. operands were successfully exported.
  102. .IP >0 6
  103. At least one
  104. .IR name
  105. could not be exported, or the
  106. .BR \-p
  107. option was specified and an error occurred.
  108. .SH "CONSEQUENCES OF ERRORS"
  109. Default.
  110. .LP
  111. .IR "The following sections are informative."
  112. .SH "APPLICATION USAGE"
  113. Note that, unless
  114. .IR X
  115. was previously marked readonly, the value of
  116. .BR \(dq$?\(dq
  117. after:
  118. .sp
  119. .RS 4
  120. .nf
  121. export X=$(false)
  122. .fi
  123. .P
  124. .RE
  125. .P
  126. will be 0 (because
  127. .IR export
  128. successfully set
  129. .IR X
  130. to the empty string) and that execution continues, even if
  131. .IR set
  132. .BR \-e
  133. is in effect. In order to detect command substitution failures, a user
  134. must separate the assignment from the export, as in:
  135. .sp
  136. .RS 4
  137. .nf
  138. X=$(false)
  139. export X
  140. .fi
  141. .P
  142. .RE
  143. .SH EXAMPLES
  144. Export
  145. .IR PWD
  146. and
  147. .IR HOME
  148. variables:
  149. .sp
  150. .RS 4
  151. .nf
  152. export PWD HOME
  153. .fi
  154. .P
  155. .RE
  156. .P
  157. Set and export the
  158. .IR PATH
  159. variable:
  160. .sp
  161. .RS 4
  162. .nf
  163. export PATH=/local/bin:$PATH
  164. .fi
  165. .P
  166. .RE
  167. .P
  168. Save and restore all exported variables:
  169. .sp
  170. .RS 4
  171. .nf
  172. export -p > \fItemp-file\fR
  173. unset \fIa lot of variables\fR
  174. \&... \fIprocessing\fR
  175. \&. \fItemp-file\fR
  176. .fi
  177. .P
  178. .RE
  179. .SH "RATIONALE"
  180. Some historical shells use the no-argument case as the functional
  181. equivalent of what is required here with
  182. .BR \-p .
  183. This feature was left unspecified because it is not historical practice
  184. in all shells, and some scripts may rely on the now-unspecified results
  185. on their implementations. Attempts to specify the
  186. .BR \-p
  187. output as the default case were unsuccessful in achieving consensus.
  188. The
  189. .BR \-p
  190. option was added to allow portable access to the values that can be
  191. saved and then later restored using; for example, a
  192. .IR dot
  193. script.
  194. .SH "FUTURE DIRECTIONS"
  195. None.
  196. .SH "SEE ALSO"
  197. .IR "Section 2.14" ", " "Special Built-In Utilities"
  198. .P
  199. The Base Definitions volume of POSIX.1\(hy2017,
  200. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  201. .\"
  202. .SH COPYRIGHT
  203. Portions of this text are reprinted and reproduced in electronic form
  204. from IEEE Std 1003.1-2017, Standard for Information Technology
  205. -- Portable Operating System Interface (POSIX), The Open Group Base
  206. Specifications Issue 7, 2018 Edition,
  207. Copyright (C) 2018 by the Institute of
  208. Electrical and Electronics Engineers, Inc and The Open Group.
  209. In the event of any discrepancy between this version and the original IEEE and
  210. The Open Group Standard, the original IEEE and The Open Group Standard
  211. is the referee document. The original Standard can be obtained online at
  212. http://www.opengroup.org/unix/online.html .
  213. .PP
  214. Any typographical or formatting errors that appear
  215. in this page are most likely
  216. to have been introduced during the conversion of the source files to
  217. man page format. To report such errors, see
  218. https://www.kernel.org/doc/man-pages/reporting_bugs.html .