Date: Fri, 15 Apr 2011 15:26:05 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r220655 - head/tools/regression/bin/sh/expansion Message-ID: <201104151526.p3FFQ5oU073802@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Fri Apr 15 15:26:05 2011 New Revision: 220655 URL: http://svn.freebsd.org/changeset/base/220655 Log: sh: Add test for obscure and ambiguous ${#?}. Added: head/tools/regression/bin/sh/expansion/length4.0 (contents, props changed) Added: head/tools/regression/bin/sh/expansion/length4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/length4.0 Fri Apr 15 15:26:05 2011 (r220655) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +# The construct ${#?} is ambiguous in POSIX.1-2008: it could be the length +# of $? or it could be $# giving an error in the (impossible) case that it +# is not set. +# We use the former interpretation; it seems more useful. + +: +[ "${#?}" = 1 ] || echo '${#?} wrong' +(exit 42) +[ "${#?}" = 2 ] || echo '${#?} wrong'
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104151526.p3FFQ5oU073802>