If I unintentionally add a newline in a command, as far as I can tell, the only way to undo it is to press Ctrl+c and type the command again. For example:$ cat 'John's File'> ^C$ cat John's FileThis is annoying if the original command is long.Is there a way to delete the newline and remove the > prompt so that I can go back to the original command?
How can I undo an accidental newline in bash?
bash;line editor
Is there a way to delete the newline ... ?Actually: No.But there are excellent workarounds.As you have already introduced an Enter, the line has been stored in the list of commands executed. Press ControlC to get out of the command, then, without re-typing, press up-arrow. The command entered appears again, and could be edited.