svn commit: r220655 - head/tools/regression/bin/sh/expansion

Jilles Tjoelker jilles at FreeBSD.org
Fri Apr 15 15:26:06 UTC 2011


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'


More information about the svn-src-all mailing list