【发布时间】:2021-04-22 12:19:14
【问题描述】:
我在 Windows 上使用 Git Bash,尤其是命令 'find' 和 'grep' 来定位包含一些文本的文件。
我设置了别名grep='grep --color=auto',它在单独使用时显示颜色很好,但是如果我输入:
find . -iname "*.java" | xargs grep my_word
my_word 的出现不以彩色显示。颜色只有在我输入时才会出现:
find . -iname "*.java" | xargs grep --color=auto my_word
换句话说,别名似乎没有用在管道的右侧。
这是管道中别名的正常行为吗?我无法在文档中找到答案。
谢谢。
【问题讨论】:
标签: bash colors grep pipe alias