How do I add a command to bash history without executing it?

Viewed 2406

Use case is:

I type a long command and then I realize I need to run something else first.

I usually run it then CTRL C immediately.

I guess I could also do echo "command" >> $HISTFILE, but that won't work with quotes.

5 Answers
Related