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