utility
pwd — external utility
Prints the current working directory. GNU external pwd defaults to physical traversal (unless POSIXLY_CORRECT is set); -L requests a valid logical PWD and -P resolves symlinks. Bash also has a pwd builtin. Use an explicit executable path when comparing implementations. Fixture checks directory identity without exposing an absolute temp path. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): alias; real.
Formal Syntax & Structure
bash syntaxbash
/usr/bin/pwd [-L|-P]Return Value
exit status
Zero on successful operation; nonzero on errors.
Working Example
Example Snippetbash
mkdir realln -s real aliascd alias || exit 1logical=$(builtin pwd -L)physical=$(/usr/bin/pwd -P)printf '%s\n' "${logical##*/}" "${physical##*/}"