我想像使用带有 --line-buffered 的 grep 一样使用 ag。可能吗?如果不是,我还有什么其他选择可以模仿这种行为?
最佳答案
我希望 ag
也支持 --line-buffered
风格的功能。
我提出了PR #719针对 ag
Github 存储库请求此功能。
与此同时,我发现的最佳解决方案是用 stdbuf -oL
包装 ag
。
# instead of grep
grep --line-buffered pattern
# use ag with a stdbuf wrapper
stdbuf -oL ag pattern
关于grep - ag(silver searcher)与 grep 的 --line-buffered 类似的选项是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28982518/