1 |
On 8 May 2009, at 14:38, Stroller wrote: |
2 |
> ... |
3 |
> if echo hello|grep --color=auto l >/dev/null 2>&1; then |
4 |
> export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' |
5 |
> fi |
6 |
|
7 |
I'm afraid this thread has run away from me. I'm drinking the day's |
8 |
first cup of tea & rubbing my eyes furiously in confusion. Wha? |
9 |
I'm sure I'll comprehend the discussion better when I re-read later. |
10 |
However, is there actually any need to parse whether the grep supports |
11 |
colour before setting it? |
12 |
|
13 |
Let's say we use BSD grep or Schilling grep or whatever - is there |
14 |
actually any harm in exporting GREP_OPTIONS='--color=auto' in this case? |
15 |
|
16 |
Having written the above (so I might as well now send this message) it |
17 |
occurred to me to test it: |
18 |
|
19 |
$ GREP_OPTIONS='--not-suported' |
20 |
$ grep -i rabbit Alice\ in\ Wonderland.txt |
21 |
grep: unrecognized option '--not-suported' |
22 |
Usage: grep [OPTION]... PATTERN [FILE]... |
23 |
Try `grep --help' for more information. |
24 |
$ |
25 |
|
26 |
Presumably BSD grep & all other greps also support the GREP_OPTIONS |
27 |
environment variable? |
28 |
|
29 |
Stroller |