1 2# If fully successful, cd -Pe must be like cd -P. 3 4set -e 5 6cd "${TMPDIR:-/tmp}" 7cd -Pe / 8[ "$PWD" = / ] 9[ "$(pwd)" = / ] 10cd "${TMPDIR:-/tmp}" 11cd -eP / 12[ "$PWD" = / ] 13[ "$(pwd)" = / ] 14 15set +e 16 17# If cd -Pe cannot chdir, the exit status must be greater than 1. 18 19v=$( (cd -Pe /var/empty/nonexistent) 2>&1 >/dev/null) 20[ $? -gt 1 ] && [ -n "$v" ] 21