lib/utilities: fix `_bash-it-grep()`
1. Executing `'/usr/bin/grep'` does *not* return the path to grep... 2. use `type -p` instead of external binary `which`. 3. Simplify parameter definition. 4. Why was there a space after `%s`?pull/1933/head
parent
120dee2569
commit
22ea7d34bc
|
|
@ -60,11 +60,10 @@ _bash-it-array-dedup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Outputs a full path of the grep found on the filesystem
|
# Outputs a full path of the grep found on the filesystem
|
||||||
_bash-it-grep() {
|
function _bash-it-grep()
|
||||||
if [[ -z "${BASH_IT_GREP:-}" ]] ; then
|
{
|
||||||
export BASH_IT_GREP="$(which egrep || which grep || '/usr/bin/grep')"
|
: "${BASH_IT_GREP:=$(type -p egrep || type -p grep)}"
|
||||||
fi
|
printf "%s" "${BASH_IT_GREP:-'/usr/bin/grep'}"
|
||||||
printf "%s " "${BASH_IT_GREP}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue