man bash
描述了一个非常有用的 Event Designator
^string1^string2^
Quick substitution. Repeat the last command, replacing string1 with string2. Equivalent to ''!!:s/string1/string2/''
有没有办法在命令行输入@string1@string2@
时执行!!:gs/string1/string2/
来替换之前的命令? (@
或任何其他指定的字符/字符串)
最佳答案
^string1^string2^:g&
参见问题 Replace all occurrences of a word in the last command .
参见 Modifiers在 History Expansion .
关于bash - 替换上一个 bash 命令中所有字符串的快捷方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16284042/