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