在 Bash 中,有一个内建命令可以快速替换前一个命令中的字符串并执行结果。 相当于
!!:s^string1^string2
。 更多信息:https://www.gnu.org/software/bash/manual/bash.html#Event-Designators.
字符串1
替换为字符串2
:^{{字符串1}}^{{字符串2}}
字符串1
:^{{字符串1}}^
字符串1
替换为字符串2
,并在末尾添加字符串3
:^{{字符串1}}^{{字符串2}}^{{字符串3}}