diff options
-rw-r--r-- | bash/bashrc.d/grep.bash | 10 | ||||
-rw-r--r-- | bash/bashrc.d/ls.bash | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/bash/bashrc.d/grep.bash b/bash/bashrc.d/grep.bash index ea75bd8e..ee1bd386 100644 --- a/bash/bashrc.d/grep.bash +++ b/bash/bashrc.d/grep.bash @@ -1,14 +1,14 @@ # Function returns calculated options for grep __grepopts() { local grepopts='-I' - local grephelp=$(grep --help) - echo $grephelp | grep -- --color &>/dev/null \ + local grephelp=$(grep --help 2>/dev/null) + [[ "$grephelp" == *--color* ]] \ && grepopts="${grepopts} --color=auto" - echo $grephelp | grep -- --exclude &>/dev/null \ + [[ "$grephelp" == *--exclude* ]] \ && grepopts="${grepopts} --exclude=.git{,ignore,modules}" - echo $grephelp | grep -- --exclude-dir &>/dev/null \ + [[ "$grephelp" == *--exclude-dir* ]] \ && grepopts="${grepopts} --exclude-dir=.{cvs,git,hg,svn}" - echo $grepopts + printf '%s' $grepopts } # Alias grep with those options diff --git a/bash/bashrc.d/ls.bash b/bash/bashrc.d/ls.bash index 16172c73..26448e10 100644 --- a/bash/bashrc.d/ls.bash +++ b/bash/bashrc.d/ls.bash @@ -1,10 +1,10 @@ # Function returns calculated options for ls __lsopts() { local lsopts= - local lshelp=$(ls --help) - echo $lshelp | grep -- --color &>/dev/null \ + local lshelp=$(ls --help 2>/dev/null) + [[ "$lshelp" == *--color* ]] \ && lsopts="${lsopts} --color=auto" - echo $lsopts + printf '%s' $lsopts } # Alias ls with these options |