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