昨天看一个讲座,发现老师在执行grep命令时,匹配的字符显示有色彩的。
今天我看一下文档,发现可以通过加参数
--colour=auto 就可以了。
可以定义alias或者定义环境变量。
我喜欢定义环境变量,我定义如下:
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='01;04;32'
如果自己喜欢,可以参考如下连接来定义颜色。
http://www.termsys.demon.co.uk/vtansi.htm
Set Display Attributes
Set Attribute Mode [{attr1};...;{attrn}m
* Sets multiple display attribute settings. The following lists standard attributes:
0 Reset all attributes
1 Bright
2 Dim
4 Underscore
5 Blink
7 Reverse
8 Hidden
Foreground Colours
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 Magenta
36 Cyan
37 White
Background Colours
40 Black
41 Red
42 Green
43 Yellow
44 Blue
45 Magenta
46 Cyan
47 White
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-663079/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/267265/viewspace-663079/