# cd-p.sh: test of the cd built-in for any POSIX-compliant shell # Tests in this file may fail if the pathname of the current directory is too # long, making the pathname of temporary directories exceed PATH_MAX. posix="true" cd -P . export ORIGPWD="$PWD" mkdir -p cdpath1/foo cdpath2/foo/bar cdpath2/dev dev mkdir -m 400 no_search_dir ln -s cdpath2/foo link >file test_oE 'default operand is HOME (-L)' HOME=/dev cd -L echo --- $? pwd __IN__ --- 0 /dev __OUT__ test_oE 'default operand is HOME (-P)' HOME=/dev cd -P echo --- $? pwd __IN__ --- 0 /dev __OUT__ ( # Ensure $PWD is safe to assign to $PATH case $PWD in (*[:%]*) skip="true" esac testcase "$LINENO" 'found in first cd path (-L)' \ 3<<\__IN__ 5