gpt4 book ai didi

ruby - Ruby 脚本上的 RVM

转载 作者:太空宇宙 更新时间:2023-11-03 16:55:16 24 4
gpt4 key购买 nike

我需要使用 rvm 选择的版本运行 Ruby 脚本。我无法更改脚本的调用方式,但我可以修改脚本。脚本开始于:

#!/usr/bin/env ruby

现在,根据我找到的一些信息(例如在 this question 中),我尝试了这个:

#!/usr/bin/env rvm-shell ree-1.8.7-2012.02@gitorious

但这只会给我这个错误信息:

/usr/bin/env: rvm-shell ree-1.8.7-2012.02@gitorious: No such file or directory

现在,rvm 可用了,因为它有效(但没有带来所需的 ruby​​/gemset):

#!/usr/bin/env rvm-shell

我也试过这个:

#!/usr/local/rvm/bin/rvm-shell ree-1.8.7-2012.02@gitorious

但这不会引入环境(例如,“gem”仅安装在该 gemset 中,不可用)。如果我在命令行本身运行它,它会打开一个具有适当环境的 shell。

那么,有人做过这样的事情吗?我该如何解决?

最佳答案

这个有用吗?

#!/location/of/rvm/folder/rubies/ree-1.8.7-2012.02@gitorious/bin/ruby

关于ruby - Ruby 脚本上的 RVM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11674100/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com