chiark / gitweb /
bashrc: Add aliases for egrep and fgrep.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 9 Jan 2009 15:19:39 +0000 (15:19 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 9 Jan 2009 15:19:39 +0000 (15:19 +0000)
These got missed out, unfortunately.

bashrc

diff --git a/bashrc b/bashrc
index 3197bae48eaff0d24cf933ac8166956fcc375b43..7f4cd74ddb740e76266fd4aa8a068b77cbb5db9a 100644 (file)
--- a/bashrc
+++ b/bashrc
@@ -116,13 +116,17 @@ ls () {
 
 export GREP_COLORS="mt=01;31:ms=01;31:mc=031;31:fn=36:ln=36:bn=36:se=34"
 
-grep () {
+greplike () {
+  declare grep=$1; shift
   if [ -t 1 ]; then
-    command grep ${GREP_COLORS+--color=auto} "$@"
+    command $grep ${GREP_COLORS+--color=auto} "$@"
   else
-    command grep "$@"
+    command $grep "$@"
   fi
 }
+alias grep="greplike grep"
+alias egrep="greplike egrep"
+alias fgrep="greplike fgrep"
 
 # --- Set up some simple aliases ---