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 2>&1; 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?
> > I'm sure I'll comprehend the discussion better when I re-read later.
> > However, is there actually any need to parse whether the grep supports
> > colour before setting it?
> >
> > 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 --color, you'll get errors when it's run.

My "grep" is called "match" and it does not look at environment variables.

There are few commands that have codumented (by POSIX) environment variables for
options. I think of e.g. "make", that needs this in order to pass options to
sub-makes.

A safe method in shell scripts is to use lower case variable names.....

Jörg

-- 
 EMail:jo...@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       j...@cs.tu-berlin.de                (uni)  
       joerg.schill...@fokus.fraunhofer.de (work) Blog: 
http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily

Reply via email to