xref: /freebsd/bin/sh/tests/builtins/cd2.0 (revision ae477ca7da55f76d28859e1bd01cd1051e36f28f)
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