1PWD(P)                     POSIX Programmer's Manual                    PWD(P)
2
3
4

NAME

6       pwd - return working directory name
7

SYNOPSIS

9       pwd [-L | -P ]
10

DESCRIPTION

12       The  pwd utility shall write to standard output an absolute pathname of
13       the current working directory, which does not contain the filenames dot
14       or dot-dot.
15

OPTIONS

17       The  pwd  utility  shall  conform  to  the  Base  Definitions volume of
18       IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
19
20       The following options shall be supported by the implementation:
21
22       -L     If the PWD environment variable contains an absolute pathname of
23              the current directory that does not contain the filenames dot or
24              dot-dot, pwd shall write this pathname to standard output.  Oth‐
25              erwise, the -L option shall behave as the -P option.
26
27       -P     The  absolute pathname written shall not contain filenames that,
28              in the context of the pathname, refer to files of type  symbolic
29              link.
30
31
32       If  both -L and -P are specified, the last one shall apply.  If neither
33       -L nor -P is specified, the pwd utility shall behave as if -L had  been
34       specified.
35

OPERANDS

37       None.
38

STDIN

40       Not used.
41

INPUT FILES

43       None.
44

ENVIRONMENT VARIABLES

46       The following environment variables shall affect the execution of pwd:
47
48       LANG   Provide  a  default value for the internationalization variables
49              that are unset or null. (See  the  Base  Definitions  volume  of
50              IEEE Std 1003.1-2001,  Section  8.2,  Internationalization Vari‐
51              ables for the precedence of internationalization variables  used
52              to determine the values of locale categories.)
53
54       LC_ALL If  set  to a non-empty string value, override the values of all
55              the other internationalization variables.
56
57       LC_MESSAGES
58              Determine the locale that should be used to  affect  the  format
59              and contents of diagnostic messages written to standard error.
60
61       NLSPATH
62              Determine the location of message catalogs for the processing of
63              LC_MESSAGES .
64
65       PWD    If the -P option is in effect, this variable shall be set to  an
66              absolute pathname of the current working directory that does not
67              contain any components that specify  symbolic  links,  does  not
68              contain  any  components  that are dot, and does not contain any
69              components that are dot-dot. If an application  sets  or  unsets
70              the value of PWD , the behavior of pwd is unspecified.
71
72

ASYNCHRONOUS EVENTS

74       Default.
75

STDOUT

77       The  pwd  utility output is an absolute pathname of the current working
78       directory:
79
80
81              "%s\n", <directory pathname>
82

STDERR

84       The standard error shall be used only for diagnostic messages.
85

OUTPUT FILES

87       None.
88

EXTENDED DESCRIPTION

90       None.
91

EXIT STATUS

93       The following exit values shall be returned:
94
95        0     Successful completion.
96
97       >0     An error occurred.
98
99

CONSEQUENCES OF ERRORS

101       If an error is detected, output shall not be written to  standard  out‐
102       put,  a  diagnostic message shall be written to standard error, and the
103       exit status is not zero.
104
105       The following sections are informative.
106

APPLICATION USAGE

108       None.
109

EXAMPLES

111       None.
112

RATIONALE

114       Some implementations have historically provided pwd as a shell  special
115       built-in command.
116
117       In most utilities, if an error occurs, partial output may be written to
118       standard output. This does not happen in historical implementations  of
119       pwd. Because pwd is frequently used in historical shell scripts without
120       checking the exit status, it is important that the historical  behavior
121       is required here; therefore, the CONSEQUENCES OF ERRORS section specif‐
122       ically disallows any partial output being written to standard output.
123

FUTURE DIRECTIONS

125       None.
126

SEE ALSO

128       cd , the System Interfaces volume of IEEE Std 1003.1-2001, getcwd()
129
131       Portions of this text are reprinted and reproduced in  electronic  form
132       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
133       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
134       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
135       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
136       event of any discrepancy between this version and the original IEEE and
137       The Open Group Standard, the original IEEE and The Open Group  Standard
138       is  the  referee document. The original Standard can be obtained online
139       at http://www.opengroup.org/unix/online.html .
140
141
142
143IEEE/The Open Group                  2003                               PWD(P)
Impressum