From 5f2a4b5d8b15a373058f9b9960cf099eb334bdd7 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Sun, 13 Nov 2016 00:55:55 +0100 Subject: [PATCH] Fix search command for RedHat based distributions --- lib/search.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/search.bash b/lib/search.bash index aa9a13ea..f643ad12 100644 --- a/lib/search.bash +++ b/lib/search.bash @@ -86,7 +86,7 @@ _bash-it-search-component() { fi done - local _grep=$(which egrep || which grep) + local _grep=$((which --skip-alias grep 2> /dev/null || which grep) | tail -n 1) declare -a terms=($@) # passed on the command line declare -a matches=() # results that we found @@ -98,7 +98,7 @@ _bash-it-search-component() { [[ "${term:0:1}" == "-" ]] && negative_terms=(${negative_terms[@]} ${term:1}) && continue # print asterisk next to each result that is already enabled by the user - local term_match=($(echo "${help}"| ${_grep} -i -- ${term} | egrep '\[( |x)\]' | cut -b -30 | sed 's/ *\[ \]//g;s/ *\[x\]/*/g;' )) + local term_match=($(echo "${help}"| ${_grep} -i -- ${term} | ${_grep} -E '\[( |x)\]' | cut -b -30 | sed 's/ *\[ \]//g;s/ *\[x\]/*/g;' )) [[ "${#term_match[@]}" -gt 0 ]] && { matches=(${matches[@]} ${term_match[@]}) # append to the list of results }