From f22cba2905beafa43154745b34622e7d283e9c7d Mon Sep 17 00:00:00 2001 From: Alessandro Caianiello Date: Fri, 28 Aug 2020 14:53:34 +0100 Subject: [PATCH] lib/utils (type_exists): Include functions when searching for a command --- lib/utils.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/utils.sh b/lib/utils.sh index 86919c0..b2092ef 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -161,7 +161,13 @@ is_confirmed() { } # -# Test whether a command exists +# Test whether a command is defined. Includes: +# alias (command is shell alias) +# keyword (command is shell reserved word) +# function (command is shell function) +# builtin (command is shell builtin) +# file (command is disk file) +# # $1 = cmd to test # Usage: # if type_exists 'git'; then @@ -171,7 +177,7 @@ is_confirmed() { # fi # type_exists() { - [ "$(type -P "$1")" ] + [ "$(type -t "$1")" ] } #