Created
June 23, 2010 12:52
-
-
Save guilhermesilveira/449879 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
#!/usr/bin/env bash | |
for rvmrc in /etc/rvmrc $HOME/.rvmrc ; do | |
if [[ -f "$rvmrc" ]] ; then | |
if grep -q '^\s*rvm .*$' $rvmrc ; then | |
printf "\nError: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc" | |
exit 1 | |
else | |
source "$rvmrc" | |
fi | |
fi | |
done | |
if [[ -z "$rvm_prefix" ]] ; then unset rvm_prefix ; fi | |
if [[ -z "$rvm_path" ]] ; then unset rvm_path ; fi | |
if [[ -z "$rvm_prefix" ]] ; then | |
if [[ "root" = "$(whoami)" ]] ; then | |
rvm_prefix="/usr/local" | |
else | |
rvm_prefix="$HOME" | |
fi | |
fi | |
if [[ -z "$rvm_path" ]] ; then | |
unset rvm_path | |
if [[ "root" = "$(whoami)" ]] ; then | |
rvm_path="$rvm_prefix/rvm" | |
else | |
if [[ -d "$HOME/.rvm" ]] && [[ -s "$HOME/.rvm/scripts/rvm" ]]; then | |
rvm_path="$HOME/.rvm" | |
elif [[ -d "$rvm_prefix/rvm" ]] && [[ -s "$rvm_prefix/rvm/scripts/rvm" ]] ; then | |
rvm_path="$rvm_prefix/rvm" | |
else | |
rvm_path="$HOME/.rvm" | |
fi | |
fi | |
fi | |
rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}" | |
source $rvm_scripts_path/rvm | |
unset rvm_interactive | |
rvm $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment