man bash
describes a very useful Event Designator
^string1^string2^
Quick substitution. Repeat the last command, replacing string1 with string2. Equivalent to ''!!:s/string1/string2/''
Is there a way to execute !!:gs/string1/string2/
when typing in @string1@string2@
on the command line to replace all occurrences in the previous command? (@
or any other designated character/string)
^string1^string2^:g&
See question Replace all occurrences of a word in the last command.
See Modifiers in History Expansion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With