set-option
Bash set -o physical
Selects physical directory traversal rather than preserving logical symbolic-link components in cd and pwd. It is not a defense against filesystem races. Fixture compares directory suffixes in a private tree. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): logical=alias; physical=actual.
Formal Syntax & Structure
bash syntaxbash
set -o physical; set +o physicalReturn Value
exit status
Option-setting command returns zero for a valid request; query status is zero if enabled, one if disabled.
Working Example
Example Snippetbash
mkdir actualln -s actual aliasset +o physicalcd alias || exit 1printf 'logical=%s\n' "${PWD##*/}"cd "$HOME" || exit 1set -o physicalcd alias || exit 1printf 'physical=%s\n' "${PWD##*/}"