Skip to content

Instantly share code, notes, and snippets.

@petems
Created December 7, 2013 15:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save petems/7843821 to your computer and use it in GitHub Desktop.
Save petems/7843821 to your computer and use it in GitHub Desktop.
Bash Script to check if rbenv for RVM is installed
#!/bin/bash
command_exists () {
command "$1" &> /dev/null ;
}
if command_exists rbenv
then
echo 'rbenv found, no action needed'
elif command_exists rvm
then
echo 'rvm found, no action needed'
else
echo 'Did not find rbenv or rvm!'
echo 'Please install either tool to manage ruby'
echo 'rbenv: `brew install rbenv ruby-build`'
echo 'rvm: `\curl -sSL https://get.rvm.io | bash -s stable --ruby`'
exit 1
fi
@petems
Copy link
Author

petems commented Dec 7, 2013

If I had my way, I'd change this to only accepting rbenv, but that's just me 😄

@vt107
Copy link

vt107 commented Mar 13, 2019

How about which rbenv?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment