svn commit: r222715 - head/tools/regression/bin/sh/expansion
Jilles Tjoelker
jilles at FreeBSD.org
Sun Jun 5 12:46:27 UTC 2011
Author: jilles
Date: Sun Jun 5 12:46:26 2011
New Revision: 222715
URL: http://svn.freebsd.org/changeset/base/222715
Log:
sh: Add already working testcases for $? in here-document.
If the here-document is attached to a compound command or subshell, $?
already works properly. This is both a workaround for bin/41410 and a
requirement for a true fix for bin/41410.
PR: bin/41410
MFC after: 1 week
Added:
head/tools/regression/bin/sh/expansion/heredoc1.0 (contents, props changed)
Added: head/tools/regression/bin/sh/expansion/heredoc1.0
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/tools/regression/bin/sh/expansion/heredoc1.0 Sun Jun 5 12:46:26 2011 (r222715)
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+f() { return $1; }
+
+[ `f 42; { cat; } <<EOF
+$?
+EOF
+` = 42 ] || echo compound command bad
+
+[ `f 42; (cat) <<EOF
+$?
+EOF
+` = 42 ] || echo subshell bad
+
+long=`printf %08192d 0`
+
+[ `f 42; { cat; } <<EOF
+$long.$?
+EOF
+` = $long.42 ] || echo long compound command bad
+
+[ `f 42; (cat) <<EOF
+$long.$?
+EOF
+` = $long.42 ] || echo long subshell bad
More information about the svn-src-head
mailing list