Don't treat newline as pipe separator when processing substitutions.
authorMatt Kraai <kraai@debian.org>
Wed, 2 May 2001 17:52:49 +0000 (17:52 -0000)
committerMatt Kraai <kraai@debian.org>
Wed, 2 May 2001 17:52:49 +0000 (17:52 -0000)
hush.c
shell/hush.c

diff --git a/hush.c b/hush.c
index c55d86f5da63dffa81ed9a1cda4ace5f19a91e4a..01fd334868ff0543570b5b1f42b78684f57f16fa 100644 (file)
--- a/hush.c
+++ b/hush.c
@@ -2010,7 +2010,10 @@ int parse_stream(o_string *dest, struct p_context *ctx,
                } else {
                        if (m==2) {  /* unquoted IFS */
                                done_word(dest, ctx);
-                               if (ch=='\n') done_pipe(ctx,PIPE_SEQ);
+                               /* If we aren't performing a substitution, treat a newline as a
+                                * command separator.  */
+                               if (end_trigger != '\0' && ch=='\n')
+                                       done_pipe(ctx,PIPE_SEQ);
                        }
                        if (ch == end_trigger && !dest->quote && ctx->w==RES_NONE) {
                                debug_printf("leaving parse_stream\n");
index c55d86f5da63dffa81ed9a1cda4ace5f19a91e4a..01fd334868ff0543570b5b1f42b78684f57f16fa 100644 (file)
@@ -2010,7 +2010,10 @@ int parse_stream(o_string *dest, struct p_context *ctx,
                } else {
                        if (m==2) {  /* unquoted IFS */
                                done_word(dest, ctx);
-                               if (ch=='\n') done_pipe(ctx,PIPE_SEQ);
+                               /* If we aren't performing a substitution, treat a newline as a
+                                * command separator.  */
+                               if (end_trigger != '\0' && ch=='\n')
+                                       done_pipe(ctx,PIPE_SEQ);
                        }
                        if (ch == end_trigger && !dest->quote && ctx->w==RES_NONE) {
                                debug_printf("leaving parse_stream\n");