Created
          December 7, 2013 15:23 
        
      - 
      
- 
        Save petems/7843821 to your computer and use it in GitHub Desktop. 
    Bash Script to check if rbenv for RVM is installed
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/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 | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
If I had my way, I'd change this to only accepting rbenv, but that's just me 😄