1 |
On Saturday 9 May 2009, 12:15, Stroller wrote: |
2 |
> On 8 May 2009, at 14:38, Stroller wrote: |
3 |
> > ... |
4 |
> > if echo hello|grep --color=auto l >/dev/null 2>&1; then |
5 |
> > export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' |
6 |
> > fi |
7 |
> |
8 |
> I'm afraid this thread has run away from me. I'm drinking the day's |
9 |
> first cup of tea & rubbing my eyes furiously in confusion. Wha? |
10 |
> I'm sure I'll comprehend the discussion better when I re-read later. |
11 |
> However, is there actually any need to parse whether the grep supports |
12 |
> colour before setting it? |
13 |
> |
14 |
> Let's say we use BSD grep or Schilling grep or whatever - is there |
15 |
> actually any harm in exporting GREP_OPTIONS='--color=auto' in this |
16 |
> case? |
17 |
|
18 |
Yes, because if the grep implementation in question supports GREP_OPTIONS |
19 |
but doesn't support --color, you'll get errors when it's run. |
20 |
|
21 |
(The assumption the author made is that if --color is supported, then |
22 |
GREP_OPTIONS is too, which is reasonable and is what happens for GNU |
23 |
grep, although I cannot speak for other implementations). |