Use command -v instead of which.

https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then
This commit is contained in:
Greg Fitzgerald
2015-09-19 15:03:44 -04:00
parent 65581ad4ea
commit f057715a30

View File

@@ -342,14 +342,14 @@ prompt_ruby() {
return
fi
if which rvm-prompt &> /dev/null; then
if command -v rvm-prompt > /dev/null 2>&1; then
if [[ ! -n $(rvm gemset list | grep "=> (default)") ]]
then
prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(rvm-prompt i v g)"
fi
elif which chruby &> /dev/null; then
elif command -v chruby > /dev/null 2>&1; then
prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(chruby | sed -e 's/ \* //')"
elif which rbenv &> /dev/null; then
elif command -v rbenv > /dev/null 2>&1; then
prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(rbenv version | sed -e 's/ (set.*$//')"
fi
}