aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/grep.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-07-31 17:26:30 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-07-31 17:26:30 +1200
commitf5ed4cd090b321064039441e40fe46a6995abf9a (patch)
tree371166922ae8e079eca565322496068d658b00ba /bash/bashrc.d/grep.bash
parentPlace missing quotes (diff)
downloaddotfiles-f5ed4cd090b321064039441e40fe46a6995abf9a.tar.gz
dotfiles-f5ed4cd090b321064039441e40fe46a6995abf9a.zip
Use standard structure for if/for in shell
Mostly for clarity reasons; using this syntax: if [ condition ]; then commands fi As opposed to: if [ condition ] then commands fi Or: [ condition ] && command
Diffstat (limited to 'bash/bashrc.d/grep.bash')
-rw-r--r--bash/bashrc.d/grep.bash15
1 files changed, 9 insertions, 6 deletions
diff --git a/bash/bashrc.d/grep.bash b/bash/bashrc.d/grep.bash
index f2586562..62acdb01 100644
--- a/bash/bashrc.d/grep.bash
+++ b/bash/bashrc.d/grep.bash
@@ -2,12 +2,15 @@
__grepopts() {
local grepopts='-I'
local grephelp="$(grep --help 2>/dev/null)"
- [[ "$grephelp" == *--color* ]] \
- && grepopts="${grepopts} --color=auto"
- [[ "$grephelp" == *--exclude* ]] \
- && grepopts="${grepopts} --exclude=.git{,ignore,modules}"
- [[ "$grephelp" == *--exclude-dir* ]] \
- && grepopts="${grepopts} --exclude-dir=.{cvs,git,hg,svn}"
+ if [[ "$grephelp" == *--color* ]]; then
+ grepopts="${grepopts} --color=auto"
+ fi
+ if [[ "$grephelp" == *--exclude* ]]; then
+ grepopts="${grepopts} --exclude=.git{,ignore,modules}"
+ fi
+ if [[ "$grephelp" == *--exclude-dir* ]]; then
+ grepopts="${grepopts} --exclude-dir=.{cvs,git,hg,svn}"
+ fi
printf '%s' "$grepopts"
}