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