我的 bash 版本:
GNU bash, version 3.2.49(22)-release (i686-pc-cygwin)
Copyright (C) 2007 Free Software Foundation, Inc.
在我的 .bashrc 中,我有:
export GREP_OPTIONS='--color=always'
要重现该问题,请创建一个文件 test.txt 并写几行:
test1: apple
test2: orange
test3: cherry
在 bash 中,执行 grep:
grep "test" test.txt > 1
当我检查结果时,我得到如下信息:
~ > cat -v 1
^[[01;31m^[[Ktest^[[m^[[K1: apple
^[[01;31m^[[Ktest^[[m^[[K2: orange
^[[01;31m^[[Ktest^[[m^[[K3: cherry
关于这个问题的任何想法?顺便说一句,我已经设置了 fileformats=unix。