diff options
Diffstat (limited to '_zsh')
-rw-r--r-- | _zsh/40-functions.zsh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/_zsh/40-functions.zsh b/_zsh/40-functions.zsh index 77db01c..2b078ed 100644 --- a/_zsh/40-functions.zsh +++ b/_zsh/40-functions.zsh @@ -5,8 +5,12 @@ # ## Check the existence/accessibility of a command +# Credit: https://stackoverflow.com/a/677212/4856091 function exists() { - which $1 &> /dev/null + # 'command' is POSIX-compliant and more portable; + # 'hash' only searches for commands; + # while 'type' also considers builtins and keywords. + type "$1" >/dev/null 2>&1 } ## Check whether the program is running |