bashrc: `grep' hacking.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 7 Jul 2009 18:21:50 +0000 (19:21 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 7 Jul 2009 18:21:50 +0000 (19:21 +0100)
Firstly, introduce `zgrep' to the ranks of hacked greps.  Secondly, run
results of `grep' through a pager.

bashrc

diff --git a/bashrc b/bashrc
index fd91584..7f00141 100644 (file)
--- a/bashrc
+++ b/bashrc
@@ -119,7 +119,7 @@ export GREP_COLORS="mt=01;31:ms=01;31:mc=031;31:fn=36:ln=36:bn=36:se=34"
 greplike () {
   declare grep=$1; shift
   if [ -t 1 ]; then
-    command $grep ${GREP_COLORS+--color=auto} "$@"
+    command $grep ${GREP_COLORS+--color=always} "$@" | mdw-pager
   else
     command $grep "$@"
   fi
@@ -127,6 +127,7 @@ greplike () {
 alias grep="greplike grep"
 alias egrep="greplike egrep"
 alias fgrep="greplike fgrep"
+alias zgrep="greplike fgrep"
 
 # --- Set up some simple aliases ---