aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/grep.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-08-18 23:45:07 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-08-18 23:45:07 +1200
commit722d720fdc875f2a1916e0875d4ebf2a36ebc4ab (patch)
tree2cf5beb4367bef6c6e2fe9bb67846f379eb53013 /bash/bashrc.d/grep.bash
parentAdd some comments to the ls/grep alias functions (diff)
downloaddotfiles-722d720fdc875f2a1916e0875d4ebf2a36ebc4ab.tar.gz
dotfiles-722d720fdc875f2a1916e0875d4ebf2a36ebc4ab.zip
Move --color option for grep to end of alias
Diffstat (limited to 'bash/bashrc.d/grep.bash')
-rw-r--r--bash/bashrc.d/grep.bash14
1 files changed, 7 insertions, 7 deletions
diff --git a/bash/bashrc.d/grep.bash b/bash/bashrc.d/grep.bash
index dcb27781..656e3c77 100644
--- a/bash/bashrc.d/grep.bash
+++ b/bash/bashrc.d/grep.bash
@@ -10,13 +10,6 @@ __grepopts() {
# Add option to ignore binary files
grepopts[${#grepopts[@]}]='-I'
- # If the --color option is available and we have a terminal that supports
- # at least eight colors, add --color=auto to the options
- local -i colors="$(tput colors)"
- if [[ "$grephelp" == *--color* ]] && ((colors >= 8)); then
- grepopts[${#grepopts[@]}]='--color=auto'
- fi
-
# If the --exclude option is available, exclude some VCS files
if [[ "$grephelp" == *--exclude* ]]; then
grepopts[${#grepopts[@]}]='--exclude=.git{,ignore,modules}'
@@ -27,6 +20,13 @@ __grepopts() {
grepopts[${#grepopts[@]}]='--exclude-dir=.{cvs,git,hg,svn}'
fi
+ # If the --color option is available and we have a terminal that supports
+ # at least eight colors, add --color=auto to the options
+ local -i colors="$(tput colors)"
+ if [[ "$grephelp" == *--color* ]] && ((colors >= 8)); then
+ grepopts[${#grepopts[@]}]='--color=auto'
+ fi
+
# Print the options as a single string, space-delimited
printf -- "${grepopts[*]}"
}