当我尝试使用此命令在 grep 手册中搜索颜色选项时,怎么会出现这种情况
man grep | grep "color"
我没有得到结果,但是当我运行时
man grep
man 输出这个 [EDITED]
--colour=[when, --color=[when]]
Mark up the matching text with the expression stored in GREP_COLOR environment variable. The possible values of when can be `never', `always' or `auto'.
最佳答案
尝试通过 col -b
管道手册页,在 grep 之前清除任何特殊字符。
例如:
man grep | col -b | grep "color"
或者,指定 col -b
作为你的 man pager:
man -P "col -b" grep | grep "color"
您甚至可以在您的 shell 配置文件中设置 MANPAGER 以使其更持久。
export MANPAGER='col -b | less'
但是,这意味着您在查看手册页时会失去漂亮的颜色。
关于bash - 男人 grep | grep "color"没有给出结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12600533/