Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

sh: Add testcase for $? in here-document.

Obtained-from:  FreeBSD 222715
  • Loading branch information...
commit 7975815b04775132a30684282b0f33191f0399c4 1 parent 406adc9
authored December 25, 2011
25  tools/regression/bin/sh/expansion/heredoc1.0
... ...
@@ -0,0 +1,25 @@
  1
+# $FreeBSD: src/tools/regression/bin/sh/expansion/heredoc1.0,v 1.1 2011/06/05 12:46:26 jilles Exp $
  2
+
  3
+f() { return $1; }
  4
+
  5
+[ `f 42; { cat; } <<EOF
  6
+$?
  7
+EOF
  8
+` = 42 ] || echo compound command bad
  9
+
  10
+[ `f 42; (cat) <<EOF
  11
+$?
  12
+EOF
  13
+` = 42 ] || echo subshell bad
  14
+
  15
+long=`printf %08192d 0`
  16
+
  17
+[ `f 42; { cat; } <<EOF
  18
+$long.$?
  19
+EOF
  20
+` = $long.42 ] || echo long compound command bad
  21
+
  22
+[ `f 42; (cat) <<EOF
  23
+$long.$?
  24
+EOF
  25
+` = $long.42 ] || echo long subshell bad

0 notes on commit 7975815

Please sign in to comment.
Something went wrong with that request. Please try again.