aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/hush.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 6970c50c4..3581ba119 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -4141,15 +4141,26 @@ static struct pipe *parse_stream(char **pstring,
4141 && dest.length == 0 && !dest.has_quoted_part 4141 && dest.length == 0 && !dest.has_quoted_part
4142 ) { 4142 ) {
4143 /* This newline can be ignored. But... 4143 /* This newline can be ignored. But...
4144 * without the below check, interactive shell 4144 * Without check #1, interactive shell
4145 * will ignore even lines with bare <newline>, 4145 * ignores even bare <newline>,
4146 * and show the continuation prompt: 4146 * and shows the continuation prompt:
4147 * ps1_prompt$ <enter> 4147 * ps1_prompt$ <enter>
4148 * ps2> _ <=== wrong prompt, should be ps1 4148 * ps2> _ <=== wrong, should be ps1
4149 * Without check #2, "cmd & <newline>"
4150 * is similarly mistreated.
4151 * (BTW, this makes "cmd & cmd"
4152 * and "cmd && cmd" non-orthogonal.
4153 * Really, ask yourself, why
4154 * "cmd && <newline>" doesn't start
4155 * cmd but waits for more input?
4156 * No reason...)
4149 */ 4157 */
4150 struct pipe *pi = ctx.list_head; 4158 struct pipe *pi = ctx.list_head;
4151 if (pi->num_cmds != 0) 4159 if (pi->num_cmds != 0 /* check #1 */
4160 && pi->followup != PIPE_BG /* check #2 */
4161 ) {
4152 continue; 4162 continue;
4163 }
4153 } 4164 }
4154 /* Treat newline as a command separator. */ 4165 /* Treat newline as a command separator. */
4155 done_pipe(&ctx, PIPE_SEQ); 4166 done_pipe(&ctx, PIPE_SEQ);