The pwd built-in prints the current working directory.
Syntax
-
pwd [-L|-P]
Description
The pwd built-in prints an absolute path to the shell’s current working directory to the standard output.
Options
-
-L
-
--logical
-
If the value of the
PWD
variable is an absolute path to the shell’s working directory and the path does not contain any.
or..
components, then the path is printed. Otherwise, the printed path is the same as when the-P
option is specified. -
-P
-
--physical
-
The printed path does not contain any
.
or..
components, symbolic link components, or redundant slashes.
The -L
(--logical
) and -P
(--physical
) options are mutually exclusive:
only the last specified one is effective.
If neither is specified, -L
is assumed.
Exit status
The exit status of the pwd built-in is zero unless there is any error.
Notes
The pwd built-in is a mandatory built-in.