![grep 输出不在 stdout 或 stderr 中](https://linux22.com/image/1582698/grep%20%E8%BE%93%E5%87%BA%E4%B8%8D%E5%9C%A8%20stdout%20%E6%88%96%20stderr%20%E4%B8%AD.png)
我正在尝试使用以下 bash 命令查找包含“ash”和“bun”的文件:
grep --line-buffered -ril ash | xargs -d '\n' grep -il bun
只有第一个 grep 的输出(包含“ash”的文件的名称)按预期显示在终端屏幕上,但没有任何内容打印到管道。我使用以下命令验证了这一点:
grep --line-buffered -ril ash &> junk
垃圾是空的。
我有 GNOME Terminal 3.6.2、GNU grep 2.16 和 Ubuntu 14.04。grep 的输出是彩色的。
我知道 grep 的缓冲怪癖,但输出出现在单独的行上,所以我认为它正在被刷新。
有人吗?