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

pwd.1p (6145B)


  1. '\" et
  2. .TH PWD "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. pwd
  12. \(em return working directory name
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. pwd \fB[\fR-L|-P\fB]\fR
  17. .fi
  18. .SH DESCRIPTION
  19. The
  20. .IR pwd
  21. utility shall write to standard output an absolute pathname of the
  22. current working directory, which does not contain the filenames dot or
  23. dot-dot.
  24. .SH OPTIONS
  25. The
  26. .IR pwd
  27. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  28. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  29. .P
  30. The following options shall be supported by the implementation:
  31. .IP "\fB\-L\fP" 10
  32. If the
  33. .IR PWD
  34. environment variable contains an absolute pathname of the current directory
  35. and the pathname does not contain any components that are dot or dot-dot,
  36. .IR pwd
  37. shall write this pathname to standard output, except that if the
  38. .IR PWD
  39. environment variable is longer than
  40. {PATH_MAX}
  41. bytes including the terminating null, it is unspecified whether
  42. .IR pwd
  43. writes this pathname to standard output or behaves as if the
  44. .BR \-P
  45. option had been specified. Otherwise, the
  46. .BR \-L
  47. option shall behave as the
  48. .BR \-P
  49. option.
  50. .IP "\fB\-P\fP" 10
  51. The pathname written to standard output shall not contain any components
  52. that refer to files of type symbolic link. If there are multiple pathnames
  53. that the
  54. .IR pwd
  55. utility could write to standard output, one beginning with a single
  56. <slash>
  57. character and one or more beginning with two
  58. <slash>
  59. characters, then it shall write the pathname beginning with a single
  60. <slash>
  61. character. The pathname shall not contain any unnecessary
  62. <slash>
  63. characters after the leading one or two
  64. <slash>
  65. characters.
  66. .P
  67. If both
  68. .BR \-L
  69. and
  70. .BR \-P
  71. are specified, the last one shall apply. If neither
  72. .BR \-L
  73. nor
  74. .BR \-P
  75. is specified, the
  76. .IR pwd
  77. utility shall behave as if
  78. .BR \-L
  79. had been specified.
  80. .SH OPERANDS
  81. None.
  82. .SH STDIN
  83. Not used.
  84. .SH "INPUT FILES"
  85. None.
  86. .SH "ENVIRONMENT VARIABLES"
  87. The following environment variables shall affect the execution of
  88. .IR pwd :
  89. .IP "\fILANG\fP" 10
  90. Provide a default value for the internationalization variables that are
  91. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  92. .IR "Section 8.2" ", " "Internationalization Variables"
  93. the precedence of internationalization variables used to determine the
  94. values of locale categories.)
  95. .IP "\fILC_ALL\fP" 10
  96. If set to a non-empty string value, override the values of all the
  97. other internationalization variables.
  98. .IP "\fILC_MESSAGES\fP" 10
  99. .br
  100. Determine the locale that should be used to affect the format and
  101. contents of diagnostic messages written to standard error.
  102. .IP "\fINLSPATH\fP" 10
  103. Determine the location of message catalogs for the processing of
  104. .IR LC_MESSAGES .
  105. .IP "\fIPWD\fP" 10
  106. An absolute pathname of the current working directory. If an
  107. application sets or unsets the value of
  108. .IR PWD ,
  109. the behavior of
  110. .IR pwd
  111. is unspecified.
  112. .SH "ASYNCHRONOUS EVENTS"
  113. Default.
  114. .SH STDOUT
  115. The
  116. .IR pwd
  117. utility output is an absolute pathname of the current working
  118. directory:
  119. .sp
  120. .RS 4
  121. .nf
  122. "%s\en", <\fIdirectory pathname\fR>
  123. .fi
  124. .P
  125. .RE
  126. .SH STDERR
  127. The standard error shall be used only for diagnostic messages.
  128. .SH "OUTPUT FILES"
  129. None.
  130. .SH "EXTENDED DESCRIPTION"
  131. None.
  132. .SH "EXIT STATUS"
  133. The following exit values shall be returned:
  134. .IP "\00" 6
  135. Successful completion.
  136. .IP >0 6
  137. An error occurred.
  138. .SH "CONSEQUENCES OF ERRORS"
  139. If an error is detected, output shall not be written to standard
  140. output, a diagnostic message shall be written to standard error, and
  141. the exit status is not zero.
  142. .LP
  143. .IR "The following sections are informative."
  144. .SH "APPLICATION USAGE"
  145. If the pathname obtained from
  146. .IR pwd
  147. is longer than
  148. {PATH_MAX}
  149. bytes, it could produce an error if passed to
  150. .IR cd .
  151. Therefore, in order to return to that directory it may be necessary to
  152. break the pathname into sections shorter than
  153. {PATH_MAX}
  154. and call
  155. .IR cd
  156. on each section in turn (the first section being an absolute pathname
  157. and subsequent sections being relative pathnames).
  158. .SH EXAMPLES
  159. None.
  160. .SH RATIONALE
  161. Some implementations have historically provided
  162. .IR pwd
  163. as a shell special built-in command.
  164. .P
  165. In most utilities, if an error occurs, partial output may be written to
  166. standard output. This does not happen in historical implementations of
  167. .IR pwd .
  168. Because
  169. .IR pwd
  170. is frequently used in historical shell scripts without checking the
  171. exit status, it is important that the historical behavior is required
  172. here; therefore, the CONSEQUENCES OF ERRORS section specifically
  173. disallows any partial output being written to standard output.
  174. .P
  175. An earlier version of this standard stated that the
  176. .IR PWD
  177. environment variable was affected when the
  178. .BR \-P
  179. option was in effect. This was incorrect; conforming implementations
  180. do not do this.
  181. .SH "FUTURE DIRECTIONS"
  182. None.
  183. .SH "SEE ALSO"
  184. .IR "\fIcd\fR\^"
  185. .P
  186. The Base Definitions volume of POSIX.1\(hy2017,
  187. .IR "Chapter 8" ", " "Environment Variables",
  188. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  189. .P
  190. The System Interfaces volume of POSIX.1\(hy2017,
  191. .IR "\fIgetcwd\fR\^(\|)"
  192. .\"
  193. .SH COPYRIGHT
  194. Portions of this text are reprinted and reproduced in electronic form
  195. from IEEE Std 1003.1-2017, Standard for Information Technology
  196. -- Portable Operating System Interface (POSIX), The Open Group Base
  197. Specifications Issue 7, 2018 Edition,
  198. Copyright (C) 2018 by the Institute of
  199. Electrical and Electronics Engineers, Inc and The Open Group.
  200. In the event of any discrepancy between this version and the original IEEE and
  201. The Open Group Standard, the original IEEE and The Open Group Standard
  202. is the referee document. The original Standard can be obtained online at
  203. http://www.opengroup.org/unix/online.html .
  204. .PP
  205. Any typographical or formatting errors that appear
  206. in this page are most likely
  207. to have been introduced during the conversion of the source files to
  208. man page format. To report such errors, see
  209. https://www.kernel.org/doc/man-pages/reporting_bugs.html .