lib/utilities: new function `_bash-it-egrep()`

The existing function `_bash-it-grep()` is weird. New function `_bash-it-egrep()` just does the thing without requiring two subshells and manual invocation.
pull/1973/head
John D Pell 2021-10-07 22:39:49 -07:00
parent b8ee63c67d
commit 253d1213e0
1 changed files with 6 additions and 0 deletions

View File

@ -65,6 +65,12 @@ function _bash-it-grep() {
printf "%s" "${BASH_IT_GREP:-'/usr/bin/grep'}"
}
# Runs `grep` with extended regular expressions
function _bash-it-egrep() {
: "${BASH_IT_GREP:=$(type -p egrep || type -p grep)}"
"${BASH_IT_GREP:-/usr/bin/grep}" -E "$@"
}
###########################################################################
# Component-specific functions (component is either an alias, a plugin, or a
# completion).