Use command -v instead of which in conditionals

Reason: https://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script/677212#677212
This commit is contained in:
Valentino 2015-10-13 10:38:07 -04:00 committed by Geoff Harcourt
parent 24634ada70
commit 9aa2cd5026
2 changed files with 2 additions and 2 deletions

View file

@ -100,7 +100,7 @@ Your `~/.vimrc.local` might look like this:
Your `~/.zshenv.local` might look like this:
# load pyenv if available
if which pyenv &>/dev/null ; then
if command -v pyenv &>/dev/null ; then
eval "$(pyenv init -)"
fi

2
zshenv
View file

@ -6,7 +6,7 @@ export EDITOR=$VISUAL
export PATH="$HOME/.bin:/usr/local/sbin:$PATH"
# load rbenv if available
if which rbenv &>/dev/null ; then
if command -v rbenv &>/dev/null ; then
eval "$(rbenv init - --no-rehash)"
fi