aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 15c7c325a..1917b552c 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12119,7 +12119,7 @@ parsesub: {
STPUTC(c, out);
c = pgetc_eatbnl();
} while (isdigit(c));
- } else if (is_special(c)) {
+ } else {
/* $[{[#]]<specialchar>[}] */
int cc = c;
@@ -12137,10 +12137,16 @@ parsesub: {
cc = '#';
}
}
+
+ if (!is_special(cc)) {
+ if (subtype == VSLENGTH)
+ subtype = 0;
+ goto badsub;
+ }
+
USTPUTC(cc, out);
- } else {
- goto badsub;
}
+
if (c != '}' && subtype == VSLENGTH) {
/* ${#VAR didn't end with } */
goto badsub;