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