summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c5
-rw-r--r--shell/ash_test/ash-vars/param_expand_alt2.right4
-rwxr-xr-xshell/ash_test/ash-vars/param_expand_alt2.tests7
-rw-r--r--shell/hush_test/hush-vars/param_expand_alt2.right4
-rwxr-xr-xshell/hush_test/hush-vars/param_expand_alt2.tests7
5 files changed, 26 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 6f8bc90..40ca82d 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11999,8 +11999,11 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
switch (SIT(c, synstack->syntax)) {
case CNL: /* '\n' */
- if (synstack->syntax == BASESYNTAX)
+ if (synstack->syntax == BASESYNTAX
+ && !synstack->varnest
+ ) {
goto endword; /* exit outer loop */
+ }
USTPUTC(c, out);
nlprompt();
c = pgetc();
diff --git a/shell/ash_test/ash-vars/param_expand_alt2.right b/shell/ash_test/ash-vars/param_expand_alt2.right
new file mode 100644
index 0000000..fef5889
--- /dev/null
+++ b/shell/ash_test/ash-vars/param_expand_alt2.right
@@ -0,0 +1,4 @@
+Unquoted: H H
+Quoted: H
+H
+Ok:0
diff --git a/shell/ash_test/ash-vars/param_expand_alt2.tests b/shell/ash_test/ash-vars/param_expand_alt2.tests
new file mode 100755
index 0000000..d8abf4c
--- /dev/null
+++ b/shell/ash_test/ash-vars/param_expand_alt2.tests
@@ -0,0 +1,7 @@
+echo Unquoted: H${$+
+}H
+
+echo Quoted: "H${$+
+}H"
+
+echo Ok:$?
diff --git a/shell/hush_test/hush-vars/param_expand_alt2.right b/shell/hush_test/hush-vars/param_expand_alt2.right
new file mode 100644
index 0000000..fef5889
--- /dev/null
+++ b/shell/hush_test/hush-vars/param_expand_alt2.right
@@ -0,0 +1,4 @@
+Unquoted: H H
+Quoted: H
+H
+Ok:0
diff --git a/shell/hush_test/hush-vars/param_expand_alt2.tests b/shell/hush_test/hush-vars/param_expand_alt2.tests
new file mode 100755
index 0000000..d8abf4c
--- /dev/null
+++ b/shell/hush_test/hush-vars/param_expand_alt2.tests
@@ -0,0 +1,7 @@
+echo Unquoted: H${$+
+}H
+
+echo Quoted: "H${$+
+}H"
+
+echo Ok:$?