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