xref: /freebsd/bin/sh/tests/builtins/cd5.0 (revision d0b2dbfa)
1
2set -e
3T=$(mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXX")
4trap 'rm -rf "$T"' 0
5
6cd -P "$T"
7D=$(pwd)
8
9mkdir a a/1 b b/1 b/2
10
11CDPATH=$D/a:
12# Basic test.
13cd 1 >/dev/null
14[ "$(pwd)" = "$D/a/1" ]
15# Test that the current directory is not checked before CDPATH.
16cd "$D/b"
17cd 1 >/dev/null
18[ "$(pwd)" = "$D/a/1" ]
19# Test not using a CDPATH entry.
20cd "$D/b"
21cd 2
22[ "$(pwd)" = "$D/b/2" ]
23