In sh (not Bash), how would we abort execution of command when the prompt is in >
mode?
For example, when entering a string with quotes only at the beginning, it makes the prompt look like >
, without the ability to quit it normally, unless hitting Ctrl + D
. Example:
root@MyPC:~# echo "hello
> I am
> (How do I exit of this mode?)
In case that I don't know which character delimits the string ("
or '
or simply escaping a newline/spaces with backslash), is there a way to let Bash know that I want to abort the execution of the current command?
Best Answer
^C
aka Ctrl+C will abort what you're doing and get you back to a normal prompt.