-
-
Save wayneeseguin/343545 to your computer and use it in GitHub Desktop.
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
# Switch to Ruby 1.8.7 | |
rvm use 1.8.7 | |
# Print out the ruby version | |
ruby -v | |
# But the output of this is: | |
# | |
# $ ./tryrvm | |
# <i> Now using ruby 1.8.7 p249 </i> | |
# ruby 1.8.6 (2010-02-05 patchlevel 399) [i686-darwin9.8.0] | |
# | |
# Why? |
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
#!/usr/bin/env bash | |
# rvm essentially has 2 methods of invocation: | |
# | |
# 1. script, ~/.rvm/bin/rvm is a *script* to execute rvm commands outside of the env | |
# environment. This method is an 'external script' and thus RVM would not be able | |
# to manage the parent shell's environment. | |
# | |
# 2. function, sourcing scripts/rvm loads rvm() as a shell *function* into a | |
# specific environment. Doing this will allow RVM to manage the shell environment. | |
# | |
# If the above does not make sense to you (I am assuming that several people will read | |
# this) please hop on IRC and let's chat. | |
# | |
# As an additional note, rvm has two verbosity modes | |
# | |
# $ rvm use X # This will output 'now using X' and is | |
# # and is not necessairly meant for scripting. | |
# | |
# $ rvm X # This will use X but not output anything | |
# # and is meant for use with scripting. | |
# | |
source $HOME/.bashrc # if rvm is sourced there. | |
# alternatively you can: source $HOME/.rvm/scripts/rvm | |
# Select 1.8.7 | |
rvm use 1.8.7 | |
# Output the current ruby version | |
ruby -v | |
# Display the information about the current environment, within this script. | |
rvm info | |
# Display the current rubygems directory for environment, within the script. | |
rvm gemdir | |
# List installed rubies | |
rvm list | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OK I tried your example and modified it a bit, and understand why it doesn't work.