This issue came up in the following help-bash thread: http://lists.gnu.org/archive/html/help-bash/2017-05/msg00001.html
Write: <echo '> then hit return. Bash will output the secondary prompt, because it expects the user to close the single quote. Run `edit-and-execute-command' to fix the input (e.g. <echo 'x'>). Bash will then execute the command, but it'll output the secondary prompt again, expecting the user to close the single quote. bash-4.4$ echo ' > echo 'x' x > Program received signal SIGINT, Interrupt. 0x00007ffff76ee2b1 in __pselect (nfds=1, readfds=0x7fffffffccb8, writefds=0x0, exceptfds=0x0, timeout=<optimized out>, sigmask=0x8101f8 <_rl_orig_sigset>) at ../sysdeps/unix/sysv/linux/pselect.c:69 69 ../sysdeps/unix/sysv/linux/pselect.c: No such file or directory. (gdb) bt #0 0x00007ffff76ee2b1 in __pselect (nfds=1, readfds=0x7fffffffccb8, writefds=0x0, exceptfds=0x0, timeout=<optimized out>, sigmask=0x8101f8 <_rl_orig_sigset>) at ../sysdeps/unix/sysv/linux/pselect.c:69 #1 0x0000000000520e32 in rl_getc (stream=0x7ffff79a58c0 <_IO_2_1_stdin_>) at input.c:515 #2 0x00000000005217cb in rl_read_key () at input.c:481 #3 0x00000000004fe038 in readline_internal_char () at readline.c:570 #4 0x00000000004ff7c2 in readline_internal_charloop () at readline.c:656 #5 0x00000000004fdb32 in readline_internal () at readline.c:670 #6 0x00000000004fd9f0 in readline (prompt=0x88d6e8 "> ") at readline.c:374 #7 0x000000000042cb08 in yy_readline_get () at ./parse.y:1464 #8 0x000000000042cc59 in yy_readline_get () at ./parse.y:1495 #9 0x0000000000431aab in yy_getc () at ./parse.y:1397 #10 0x0000000000432348 in shell_getc (remove_quoted_newline=0) at ./parse.y:2297 #11 0x0000000000436708 in parse_matched_pair (qc=39, open=39, close=39, lenp=0x7fffffffd164, flags=0) at ./parse.y:3430 #12 0x0000000000433215 in read_token_word (character=39) at ./parse.y:4857 #13 0x0000000000431768 in read_token (command=0) at ./parse.y:3338 #14 0x000000000042c16e in yylex () at ./parse.y:2683 #15 0x0000000000428abe in yyparse () at y.tab.c:1821 #16 0x00000000004285ab in parse_command () at eval.c:294 #17 0x0000000000428392 in read_command () at eval.c:338 #18 0x0000000000428091 in reader_loop () at eval.c:140 #19 0x00000000004253bb in main (argc=1, argv=0x7fffffffe498, env=0x7fffffffe4a8) at shell.c:794 Bash is still in `parse_matched_pair'-