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