xref: /dflybsd-src/tools/regression/bin/sh/expansion/length4.0 (revision 3e3895bf4584c1562faf4533cbd97026ee6a8dcf)
1*3e3895bfSKrzysztof Piecuch# $FreeBSD: head/bin/sh/tests/expansion/length4.0 220655 2011-04-15 15:26:05Z jilles $
21418520dSPeter Avalos
31418520dSPeter Avalos# The construct ${#?} is ambiguous in POSIX.1-2008: it could be the length
41418520dSPeter Avalos# of $? or it could be $# giving an error in the (impossible) case that it
51418520dSPeter Avalos# is not set.
61418520dSPeter Avalos# We use the former interpretation; it seems more useful.
71418520dSPeter Avalos
81418520dSPeter Avalos:
91418520dSPeter Avalos[ "${#?}" = 1 ] || echo '${#?} wrong'
101418520dSPeter Avalos(exit 42)
111418520dSPeter Avalos[ "${#?}" = 2 ] || echo '${#?} wrong'
12