how to use rvm in shell scripting

前端 未结 3 888
温柔的废话
温柔的废话 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 05:55

    for simply executing a command against a RVM managed Ruby (or system Ruby) do :

    rvm 1.9.3 exec camper_van
    

    this assumes rvm use 1.9.3 and gem install camper_van happened previously which provides the camper_van executable

    NOTE: RVM is expected to be loaded already - which it usually is for scripts started under your user (the RVM is not a function, selecting rubies with 'rvm use ...' confirms it's there already).

提交回复
热议问题