4 ms·
Cool trick! Adding an additional :p modifier prevents the complaint about command not found: $ # This string 'has single' "and double" quotes and a $ $ !:
by anvandare 6y ago
Cool trick!
Adding an additional :p modifier prevents the complaint about command not found:
$ # This string 'has single' "and double" quotes and a $
$ !:q
'# This string '\''has single'\'' "and double" quotes and a $'
# This string 'has single' "and double" quotes and a $: command not found
$
$ # This string 'has single' "and double" quotes and a $
$ !:q:p
'# This string '\''has single'\'' "and double" quotes and a $'
$
- mkl 6y ago!:q and then pressing M-^ (probably Alt-Shift-6) to do the history expansion is probably more useful; then you can immediately edit the line.
- ivanhoe 6y agoOr one can use `bind space:magic-space` in .bashrc to activate the auto-expansion of the history on space
- andrewaylett 6y agoOr `echo !:q`
- adrianmonk 6y agoI'm not at a computer right now, but this also seems like it should work: : !:q The appeal (to me) would be less clutter in the output.