aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-06-24 23:52:44 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-06-24 23:52:44 +1200
commit60898acf2c29565ea086bf84034fc399df72e567 (patch)
tree9dd97a5fd3bed47aa04ae9c2bfa325a1d6572db0 /bash
parentFix broken return value prompt element (diff)
downloaddotfiles-60898acf2c29565ea086bf84034fc399df72e567.tar.gz
dotfiles-60898acf2c29565ea086bf84034fc399df72e567.zip
Just check ls/grep option calls once
Diffstat (limited to 'bash')
-rw-r--r--bash/bashrc.d/grep.bash7
-rw-r--r--bash/bashrc.d/ls.bash3
2 files changed, 6 insertions, 4 deletions
diff --git a/bash/bashrc.d/grep.bash b/bash/bashrc.d/grep.bash
index 7cb38c4d..625f10ac 100644
--- a/bash/bashrc.d/grep.bash
+++ b/bash/bashrc.d/grep.bash
@@ -1,11 +1,12 @@
# Function returns calculated options for grep
function __grepopts {
local grepopts='-I'
- grep --help | grep -- --color &>/dev/null \
+ local grephelp=$(grep --help )
+ echo $grephelp | grep -- --color &>/dev/null \
&& grepopts="${grepopts} --color=auto"
- grep --help | grep -- --exclude &>/dev/null \
+ echo $grephelp | grep -- --exclude &>/dev/null \
&& grepopts="${grepopts} --exclude=.git{,ignore,modules}"
- grep --help | grep -- --exclude-dir &>/dev/null \
+ echo $grephelp | grep -- --exclude-dir &>/dev/null \
&& grepopts="${grepopts} --exclude-dir=.{cvs,git,hg,svn}"
echo $grepopts
}
diff --git a/bash/bashrc.d/ls.bash b/bash/bashrc.d/ls.bash
index 6c793a52..3883c99a 100644
--- a/bash/bashrc.d/ls.bash
+++ b/bash/bashrc.d/ls.bash
@@ -4,7 +4,8 @@ eval "$(dircolors -b &>/dev/null)"
# Function returns calculated options for ls
function __lsopts {
local lsopts=
- ls --help | grep -- --color &>/dev/null \
+ local lshelp=$(ls --help )
+ echo $lshelp | grep -- --color &>/dev/null \
&& lsopts="${lsopts} --color=auto"
echo $lsopts
}