sh: Add tests for -n flag.
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 25 Dec 2011 17:53:24 +0000 (09:53 -0800)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 25 Dec 2011 17:53:24 +0000 (09:53 -0800)
Obtained-from:  FreeBSD 222661

tools/regression/bin/sh/execution/set-n1.0 [new file with mode: 0644]
tools/regression/bin/sh/execution/set-n2.0 [new file with mode: 0644]
tools/regression/bin/sh/execution/set-n3.0 [new file with mode: 0644]

diff --git a/tools/regression/bin/sh/execution/set-n1.0 b/tools/regression/bin/sh/execution/set-n1.0
new file mode 100644 (file)
index 0000000..c03d780
--- /dev/null
@@ -0,0 +1,7 @@
+# $FreeBSD: src/tools/regression/bin/sh/execution/set-n1.0,v 1.1 2011/06/03 21:17:42 jilles Exp $
+
+v=$( ($SH -n <<'EOF'
+for
+EOF
+) 2>&1 >/dev/null)
+[ $? -ne 0 ] && [ -n "$v" ]
diff --git a/tools/regression/bin/sh/execution/set-n2.0 b/tools/regression/bin/sh/execution/set-n2.0
new file mode 100644 (file)
index 0000000..b294829
--- /dev/null
@@ -0,0 +1,5 @@
+# $FreeBSD: src/tools/regression/bin/sh/execution/set-n2.0,v 1.1 2011/06/03 21:17:42 jilles Exp $
+
+$SH -n <<'EOF'
+echo bad
+EOF
diff --git a/tools/regression/bin/sh/execution/set-n3.0 b/tools/regression/bin/sh/execution/set-n3.0
new file mode 100644 (file)
index 0000000..1a99f2b
--- /dev/null
@@ -0,0 +1,4 @@
+# $FreeBSD: src/tools/regression/bin/sh/execution/set-n3.0,v 1.1 2011/06/03 21:17:42 jilles Exp $
+
+v=$( ($SH -nc 'for') 2>&1 >/dev/null)
+[ $? -ne 0 ] && [ -n "$v" ]