插入符搜索和Bash shell中替换 [英] Caret search and replace in Bash shell
本文介绍了插入符搜索和Bash shell中替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我刚才在猛砸输入以下命令:
If I have just entered the following command in Bash:
echo foo
我可以改变美孚通过打字吧:
I can change foo to bar by typing:
^foo^bar
这导致下面的命令被执行:
Which results in the following command being executed:
echo bar
现在,如果我输入:
echo foo foo
有没有办法来改变富的两个实例通过使用插入符号( ^
)运算符?
此外,还有手册页外壳运营商如 ^
? ^人
的结果的^无需人工录入。
Additionally, are there man pages for shell operators like ^
? man ^
results in "No manual entry for ^".
推荐答案
这特定的功能被称为的快速替换的;它的文档可以在Bash手册的事件标志部分找到。你不能做你想要快速替换的东西;你得稍微详细诉诸东西:
That particular feature is called quick substitution; its documentation can be found in the Event Designators section of the Bash Manual. You can't do what you want with quick substitution; you'll have to resort to something slightly more verbose:
!!:gs/foo/bar/
这篇关于插入符搜索和Bash shell中替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文