Save command to history without executing in bash

bashhistory

Is there a way to save a command in bash history without executing it?
e.g.

$ cmd [a long list of arguments] 

and now during typing i remember I'd like to do something else first.
Can I have something like

$ cmd [a long list of arguments][some-key-strokes]

and this does not actually execute but goes into bash history so that I can use it later?

Best Answer

There may be a better way, but you can use history expansion's :p modifier to print the current comment line without executing. !# is the current line, and % by itself will match nothing

$ cmd [arguments] !#%:p
Related Question