mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
lib/utils (type_exists): Include functions when searching for a command
This commit is contained in:
committed by
Koichi Murase
parent
0a13c13c2e
commit
f22cba2905
10
lib/utils.sh
10
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")" ]
|
||||
}
|
||||
|
||||
#
|
||||
|
Reference in New Issue
Block a user