Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-09 Thread Stroller
On 8 May 2009, at 14:38, Stroller wrote: ... if echo hello|grep --color=auto l /dev/null 21; then export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' fi I'm afraid this thread has run away from me. I'm drinking the day's first cup of tea rubbing my eyes furiously in confusion. Wha?

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-09 Thread Etaoin Shrdlu
On Saturday 9 May 2009, 12:15, Stroller wrote: On 8 May 2009, at 14:38, Stroller wrote: ... if echo hello|grep --color=auto l /dev/null 21; then export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' fi I'm afraid this thread has run away from me. I'm drinking the day's first cup of

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-09 Thread Stroller
On 9 May 2009, at 11:41, Etaoin Shrdlu wrote: ... Let's say we use BSD grep or Schilling grep or whatever - is there actually any harm in exporting GREP_OPTIONS='--color=auto' in this case? Yes, because if the grep implementation in question supports GREP_OPTIONS but doesn't support

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-09 Thread Etaoin Shrdlu
On Saturday 9 May 2009, 12:43, Stroller wrote: My question is: Do BSD other greps also support GREP_OPTIONS ? A quick google search reveals that NetBSD and FreeBSD use GNU grep, while OpenBSD uses BSD grep, which (at least according to the man page - see http://tinyurl.com/cs2unf) does not

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-09 Thread Mike Kazantsev
On Sat, 9 May 2009 11:15:30 +0100 Stroller strol...@stellar.eclipse.co.uk wrote: Presumably BSD grep all other greps also support the GREP_OPTIONS environment variable? If it doesn't have support for the var then there should be no reason to pollute environment by setting it, possibly

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-09 Thread Joerg Schilling
Etaoin Shrdlu shr...@unlimitedmail.org wrote: On Saturday 9 May 2009, 12:15, Stroller wrote: On 8 May 2009, at 14:38, Stroller wrote: ... if echo hello|grep --color=auto l /dev/null 21; then export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' fi I'm afraid this thread has

[gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Stroller
Hi there, I've just realised that grep hasn't been highlighting results in colour, and it occurred to me that I was sure it has supported this facility for some time. Thus I discovered the --colour=always flag to grep and trying to make this permanent I stumbled upon this site:

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Mike Kazantsev
On Fri, 8 May 2009 14:38:58 +0100 Stroller strol...@stellar.eclipse.co.uk wrote: To find the part to which I refer you'll need to scroll down about halfway through that page to Colorize grep; the author advises adding: if echo hello|grep --color=auto l /dev/null 21; then export

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Stroller
On 8 May 2009, at 15:01, Mike Kazantsev wrote: On Fri, 8 May 2009 14:38:58 +0100 Stroller strol...@stellar.eclipse.co.uk wrote: To find the part to which I refer you'll need to scroll down about halfway through that page to Colorize grep; the author advises adding: if echo hello|grep

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Alan McKinnon
On Friday 08 May 2009 16:01:14 Mike Kazantsev wrote: On Fri, 8 May 2009 14:38:58 +0100 Stroller strol...@stellar.eclipse.co.uk wrote: To find the part to which I refer you'll need to scroll down about halfway through that page to Colorize grep; the author advises adding: if echo

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Christian
Hi Alan, Am Freitag, 8. Mai 2009 schrieb Alan McKinnon: Some greps (like BSD one) might not support '--color' option, so echo hello|grep --color=auto l will return error code, skipping if clause, and won't break grep operation by adding an unsupported option. is this really right? The

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Alan McKinnon
On Friday 08 May 2009 16:38:30 Christian wrote: Hi Alan, Am Freitag, 8. Mai 2009 schrieb Alan McKinnon: Some greps (like BSD one) might not support '--color' option, so echo hello|grep --color=auto l will return error code, skipping if clause, and won't break grep operation by adding

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Etaoin Shrdlu
On Friday 8 May 2009, 16:10, Alan McKinnon wrote: On Friday 08 May 2009 16:01:14 Mike Kazantsev wrote: On Fri, 8 May 2009 14:38:58 +0100 Stroller strol...@stellar.eclipse.co.uk wrote: To find the part to which I refer you'll need to scroll down about halfway through that page to

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Alan McKinnon
On Friday 08 May 2009 16:59:19 Etaoin Shrdlu wrote: On Friday 8 May 2009, 16:10, Alan McKinnon wrote: On Friday 08 May 2009 16:01:14 Mike Kazantsev wrote: On Fri, 8 May 2009 14:38:58 +0100 Stroller strol...@stellar.eclipse.co.uk wrote: To find the part to which I refer you'll need

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Eray Aslan
On 08.05.2009 17:10, Alan McKinnon wrote: if echo hello|grep --color=auto l /dev/null 21; then export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' fi to ~/.bashrc Why does he echo hello, please? Some greps (like BSD one) might not support '--color' option, so echo hello|grep

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Etaoin Shrdlu
On Friday 8 May 2009, 16:51, Alan McKinnon wrote: except that STDERR is combined with STDOUT and sent to /dev/null so the script will never get it, the if is always true and the entire check is redundant. Better would be if echo hello|grep --color=auto l /dev/null ; then That

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Carlos Hendson
Alan McKinnon wrote: On Friday 08 May 2009 16:01:14 Mike Kazantsev wrote: On Fri, 8 May 2009 14:38:58 +0100 Stroller strol...@stellar.eclipse.co.uk wrote: To find the part to which I refer you'll need to scroll down about halfway through that page to Colorize grep; the author advises adding:

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread Mike Kazantsev
On Fri, 8 May 2009 16:10:20 +0200 Alan McKinnon alan.mckin...@gmail.com wrote: On Friday 08 May 2009 16:01:14 Mike Kazantsev wrote: Some greps (like BSD one) might not support '--color' option, so echo hello|grep --color=auto l will return error code, skipping if clause, and won't break

Re: [gentoo-user] 'if echo hello' in .bashrc

2009-05-08 Thread James Rowe
* Carlos Hendson (skyc...@gmx.net) wrote: [1] The reason an error message is shown here is because it's bash that's reporting the broken pipe error. Grep's error message was redirected to /dev/null, which was: grep: unrecognized option '--unsupported' Usage: grep [OPTION]... PATTERN