Gentoo Archives: gentoo-user

From: Stroller <stroller@××××××××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: [gentoo-user] 'if echo hello' in .bashrc
Date: Fri, 08 May 2009 13:39:15
Message-Id: 742F0C43-196E-465B-9991-3DFF1C655803@stellar.eclipse.co.uk
1 Hi there,
2
3 I've just realised that grep hasn't been highlighting results in
4 colour, and it occurred to me that I was sure it has supported this
5 facility for some time. Thus I discovered the --colour=always flag to
6 grep and trying to make this permanent I stumbled upon this site: http://www.ccs.neu.edu/home/katz/unix-colors.html
7
8 To find the part to which I refer you'll need to scroll down about
9 halfway through that page to "Colorize grep"; the author advises adding:
10
11 if echo hello|grep --color=auto l >/dev/null 2>&1; then
12 export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
13 fi
14
15 to ~/.bashrc
16
17 Why does he echo hello, please? Is this to ensure that the file is
18 not sourced by a non-interactive shell, or by a script or something? I
19 understood that that was the difference between .bashrc
20 & .bash_profile, anyway - that "interactive commands" like colourising
21 stuff should go in .bashrc, to use /usr/local/mount instead of the
22 system on then one might alias that in .bash_profile.
23
24 It's early in the morning here, so obviously I'm not getting something.
25
26 Thanks in advance for any pointers,
27
28 Stroller.

Replies

Subject Author
Re: [gentoo-user] 'if echo hello' in .bashrc Mike Kazantsev <mike_kazantsev@×××××××.net>
Re: [gentoo-user] 'if echo hello' in .bashrc Stroller <stroller@××××××××××××××××××.uk>