分页: 1 / 1

[SOLVED]管道过来的没法高亮了

发表于 : 2009-04-10 12:52
shellex
为什么呢?
怎么让他恢复高亮?
这个高亮正常。
这个高亮正常。
这个高亮不正常
这个高亮不正常

Re: 管道过来的没法高亮了

发表于 : 2009-04-10 13:31
xhy

代码: 全选

       --color[=WHEN], --colour[=WHEN]
              Surround  the  matched (non-empty) strings, matching lines, context lines, file names, line numbers, byte offsets,
              and separators (for fields and groups of context lines) with escape sequences to display  them  in  color  on  the
              terminal.   The  colors  are defined by the environment variable GREP_COLORS.  The deprecated environment variable
              GREP_COLOR is still supported, but its setting does not have priority.  WHEN is never, always, or auto.

Re: 管道过来的没法高亮了

发表于 : 2009-04-10 13:35
eexpress
管道过滤了。

Re: 管道过来的没法高亮了

发表于 : 2009-04-10 15:27
aerofox
是不是你把 grep 设成 alias 了?
直接调用时,用到 alias,加上了 --color=auto,在用 xargs 调用时,不会使用 alias,你传给它什么参数就是什么参数。
解决办法:在 xargs 后加 --color=auto。

Re: 管道过来的没法高亮了

发表于 : 2009-04-10 15:38
shellex
Thx楼上各位

Re: [SOLVED]管道过来的没法高亮了

发表于 : 2009-04-10 17:59
BigSnake.NET
一般来说管道里面不建议用高亮,因为会插入额外的字符

Re: [SOLVED]管道过来的没法高亮了

发表于 : 2009-04-10 18:05
shellex
BigSnake.NET 写了:一般来说管道里面不建议用高亮,因为会插入额外的字符
但是grep 处于管道的末端,使用高亮应该是没问题的。