aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/grep.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/bashrc.d/grep.bash')
-rw-r--r--bash/bashrc.d/grep.bash33
1 files changed, 0 insertions, 33 deletions
diff --git a/bash/bashrc.d/grep.bash b/bash/bashrc.d/grep.bash
deleted file mode 100644
index 11eeb5b0..00000000
--- a/bash/bashrc.d/grep.bash
+++ /dev/null
@@ -1,33 +0,0 @@
-# Store whether we have colors in a variable
-declare -i colors
-colors=$( {
- tput Co || tput colors
-} 2>/dev/null )
-
-# Store grep(1)'s --help output in a variable
-grep_help=$(grep --help 2>/dev/null)
-
-# Use GREPOPTS to add some useful options to grep(1) calls if applicable; we
-# use a function wrapper to do this, rather than GREP_OPTIONS as we don't want
-# to change grep(1)'s actual behaviour inside scripts
-declare -a GREPOPTS
-if [[ -n $GREP_COLORS ]] && ((colors >= 8)) ; then
- GREPOPTS[${#GREPOPTS[@]}]='--color=auto'
-fi
-if [[ $grep_help == *--binary-files* ]] ; then
- GREPOPTS[${#GREPOPTS[@]}]='--binary-files=without-match'
-fi
-if [[ $grep_help == *--exclude* ]] ; then
- GREPOPTS[${#GREPOPTS[@]}]='--exclude={.gitignore,.gitmodules}'
-fi
-if [[ $grep_help == *--exclude-dir* ]] ; then
- GREPOPTS[${#GREPOPTS[@]}]='--exclude-dir={.cvs,.git,.hg,.svn}'
-fi
-
-# Done, unset helper vars
-unset -v grep_help colors
-
-# Define function proper
-grep() {
- command grep "${GREPOPTS[@]}" "$@"
-}