summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 9 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index fc0e15b890..138a29fab6 100644
--- a/parse.y
+++ b/parse.y
@@ -5642,7 +5642,14 @@ tokadd_string(struct parser_params *p,
switch (c) {
case '\n':
if (func & STR_FUNC_QWORDS) break;
- if (func & STR_FUNC_EXPAND) continue;
+ if (func & STR_FUNC_EXPAND) {
+ if (!(func & STR_FUNC_INDENT) || (p->heredoc_indent < 0))
+ continue;
+ if (c == term) {
+ c = '\\';
+ goto terminate;
+ }
+ }
tokadd(p, '\\');
break;
@@ -5723,6 +5730,7 @@ tokadd_string(struct parser_params *p,
}
tokadd(p, c);
}
+ terminate:
if (enc) *encp = enc;
return c;
}