I made a mistake writing a command at the SQLite command prompt, which I now want to abort, this is how my command line looks
sqlite> select * from todos'
...> '
...> ;^C
In this case, likely because I have opened a quote, I can't even hit ENTER
to run the command. I just get a line continuation, that would still be less than ideal because I would be having to run bad code and cause and error, just to regain control of the prompt.
How can I cancel the line/command and get returned back to a prompt?
Best Answer
The
sqlite3
interface uses the ReadLine library for command line editing. You can erase a full line with Ctrl+U but once you have pressed Enter, the line has been accepted and is no longer editable.As you've noticed, sending Ctrl+D will prompt the client to exit, which is not what you want.
Your best bet is to
;
, generate a deliberate syntax error.In your example:
This will ensure that nothing gets executed, and it will leave you in the SQLite session with any temporary tables intact.