how to use rvm in shell scripting

前端 未结 3 889
温柔的废话
温柔的废话 2021-02-13 05:12

is it possible to load rvm in shell script . can any one give an example of it. when i try a shell script . i am using ubuntu system

#!/bin/bash
rvm use 1.9.3
         


        
3条回答
  •  你的背包
    2021-02-13 06:13

    # Load RVM into a shell session *as a function*
    # Loading RVM *as a function* is mandatory
    # so that we can use 'rvm use '
    if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
      # First try to load from a user install
      source "$HOME/.rvm/scripts/rvm"
      echo "using user install $HOME/.rvm/scripts/rvm"
    elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
      # Then try to load from a root install
      source "/usr/local/rvm/scripts/rvm"
      echo "using root install /usr/local/rvm/scripts/rvm"
    else
      echo "ERROR: An RVM installation was not found.\n"
    fi
    

提交回复
热议问题