[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19998: GREP_OPTIONS alternative?

From: Christian Kujau
Subject: bug#19998: GREP_OPTIONS alternative?
Date: Wed, 11 Mar 2015 15:53:35 -0700 (PDT)
User-agent: Alpine 2.19.4 (DEB 40 2013-11-18)

On Wed, 11 Mar 2015 at 15:33, Paul Eggert wrote:
> > 1) Write a script for each grep variant (fgrep, zgrep, egrep, etc.)
> > 2) put $HOME/bin in $PATH
> No, you don't need to write a script for each grep variant.  You need to write
> a script only for 'grep'.  That's because fgrep etc. invoke grep.

One might think so, but it doesn't work. On a Debian/Linux or a 
SuSE Linux system, /bin/*grep are not symlinks to /bin/grep but
seperate executables. Even zgrep (a shell script) rewrites itself
to /usr/bin/bin and thus $HOME/bin/grep is never called.

> It's too error-prone to have fundamental utilities' behavior depend on
> settings of random environment variables.

Why is GREP_OPTIONS random and LESS or ZIPOPT or GZIP are not?


$ cat $HOME/bin/grep
export PATH=/usr/bin:/bin
exec grep --line-number "$@"

$ export PATH=$HOME/bin:$PATH

$ echo hello | grep ll

$ echo hello | fgrep ll
BOFH excuse #143:

had to use hammer to free stuck disk drive heads.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]