Gentoo Archives: gentoo-user

From: Stroller <stroller@××××××××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] 'if echo hello' in .bashrc
Date: Sat, 09 May 2009 10:15:35
Message-Id: 5E74755A-7D9B-4286-B1B1-91735F1F7C07@stellar.eclipse.co.uk
In Reply to: [gentoo-user] 'if echo hello' in .bashrc by Stroller
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

Replies

Subject Author
Re: [gentoo-user] 'if echo hello' in .bashrc Etaoin Shrdlu <shrdlu@×××××××××××××.org>
Re: [gentoo-user] 'if echo hello' in .bashrc Mike Kazantsev <mike_kazantsev@×××××××.net>