man-pages/man1p/pwd.1p

157 lines
4.5 KiB
Groff

.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
.TH "PWD" 1P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" pwd
.SH NAME
pwd \- return working directory name
.SH SYNOPSIS
.LP
\fBpwd\fP \fB[\fP\fB-L | -P\fP \fB]\fP
.SH DESCRIPTION
.LP
The \fIpwd\fP utility shall write to standard output an absolute pathname
of the current working directory, which does not
contain the filenames dot or dot-dot.
.SH OPTIONS
.LP
The \fIpwd\fP utility shall conform to the Base Definitions volume
of IEEE\ Std\ 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
.LP
The following options shall be supported by the implementation:
.TP 7
\fB-L\fP
If the \fIPWD\fP environment variable contains an absolute pathname
of the current directory that does not contain the
filenames dot or dot-dot, \fIpwd\fP shall write this pathname to standard
output. Otherwise, the \fB-L\fP option shall behave as
the \fB-P\fP option.
.TP 7
\fB-P\fP
The absolute pathname written shall not contain filenames that, in
the context of the pathname, refer to files of type symbolic
link.
.sp
.LP
If both \fB-L\fP and \fB-P\fP are specified, the last one shall apply.
If neither \fB-L\fP nor \fB-P\fP is specified, the
\fIpwd\fP utility shall behave as if \fB-L\fP had been specified.
.SH OPERANDS
.LP
None.
.SH STDIN
.LP
Not used.
.SH INPUT FILES
.LP
None.
.SH ENVIRONMENT VARIABLES
.LP
The following environment variables shall affect the execution of
\fIpwd\fP:
.TP 7
\fILANG\fP
Provide a default value for the internationalization variables that
are unset or null. (See the Base Definitions volume of
IEEE\ Std\ 1003.1-2001, Section 8.2, Internationalization Variables
for
the precedence of internationalization variables used to determine
the values of locale categories.)
.TP 7
\fILC_ALL\fP
If set to a non-empty string value, override the values of all the
other internationalization variables.
.TP 7
\fILC_MESSAGES\fP
Determine the locale that should be used to affect the format and
contents of diagnostic messages written to standard
error.
.TP 7
\fINLSPATH\fP
Determine the location of message catalogs for the processing of \fILC_MESSAGES
\&.\fP
.TP 7
\fIPWD\fP
If the \fB-P\fP option is in effect, this variable shall be set to
an absolute pathname of the current working directory that
does not contain any components that specify symbolic links, does
not contain any components that are dot, and does not contain any
components that are dot-dot. If an application sets or unsets the
value of \fIPWD ,\fP the behavior of \fIpwd\fP is
unspecified.
.sp
.SH ASYNCHRONOUS EVENTS
.LP
Default.
.SH STDOUT
.LP
The \fIpwd\fP utility output is an absolute pathname of the current
working directory:
.sp
.RS
.nf
\fB"%s\\n", <\fP\fIdirectory pathname\fP\fB>
\fP
.fi
.RE
.SH STDERR
.LP
The standard error shall be used only for diagnostic messages.
.SH OUTPUT FILES
.LP
None.
.SH EXTENDED DESCRIPTION
.LP
None.
.SH EXIT STATUS
.LP
The following exit values shall be returned:
.TP 7
\ 0
Successful completion.
.TP 7
>0
An error occurred.
.sp
.SH CONSEQUENCES OF ERRORS
.LP
If an error is detected, output shall not be written to standard output,
a diagnostic message shall be written to standard
error, and the exit status is not zero.
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
None.
.SH EXAMPLES
.LP
None.
.SH RATIONALE
.LP
Some implementations have historically provided \fIpwd\fP as a shell
special built-in command.
.LP
In most utilities, if an error occurs, partial output may be written
to standard output. This does not happen in historical
implementations of \fIpwd\fP. Because \fIpwd\fP is frequently used
in historical shell scripts without checking the exit status,
it is important that the historical behavior is required here; therefore,
the CONSEQUENCES OF ERRORS section specifically disallows
any partial output being written to standard output.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIcd\fP , the System Interfaces volume of IEEE\ Std\ 1003.1-2001,
\fIgetcwd\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .