xref: /freebsd/bin/sh/tests/builtins/cd2.0 (revision d37eb51047221dc3322b34db1038ff3aa533883f)
1set -e
2
3L=$(getconf PATH_MAX / 2>/dev/null) || L=4096
4[ "$L" -lt 100000 ] 2>/dev/null || L=4096
5L=$((L+100))
6T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX)
7trap 'rm -rf ${T}' 0
8cd $T
9D=$T
10while [ ${#D} -lt $L ]; do
11	mkdir veryverylongdirectoryname
12	cd veryverylongdirectoryname
13	D=$D/veryverylongdirectoryname
14done
15[ $(pwd | wc -c) -eq $((${#D} + 1)) ] # +\n
16