mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-16 06:52:27 +00:00
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
This commit is contained in:
parent
7de7a90404
commit
b17788c1a9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=222715
25
tools/regression/bin/sh/expansion/heredoc1.0
Normal file
25
tools/regression/bin/sh/expansion/heredoc1.0
Normal file
|
@ -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
|
Loading…
Reference in a new issue