lib/utilities: handle unbound parameter

Expressly handle unbound $BASH_IT_GREP when testing for value
This commit is contained in:
John D Pell
2021-07-25 21:59:40 -07:00
parent 233fcc3091
commit 0eff44930c

2
lib/utilities.bash Normal file → Executable file
View File

@@ -58,7 +58,7 @@ _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() { _bash-it-grep() {
if [[ -z "${BASH_IT_GREP}" ]] ; then if [[ -z "${BASH_IT_GREP:-}" ]] ; then
export BASH_IT_GREP="$(which egrep || which grep || '/usr/bin/grep')" export BASH_IT_GREP="$(which egrep || which grep || '/usr/bin/grep')"
fi fi
printf "%s " "${BASH_IT_GREP}" printf "%s " "${BASH_IT_GREP}"