rvm-shell命令停止执行其他命令

时间:2013-11-18 08:35:37

标签: ruby rvm

我编写了一个shell脚本,我写了一个rvm-shell命令。问题是此命令无法执行后的任何行。脚本如下:

#!/bin/bash
set x
rvm-shell ruby-1.9.3-p448@global //after this line not anything get executed
echo $?  //not get executed
clear    //not get executed

rails s  //not get executed which i want to run

1 个答案:

答案 0 :(得分:2)

rvm-shell ruby-1.9.3-p448@global

没有任何参数等同于运行

rvm ruby-1.9.3-p448@global do bash

将进入shell会话并等待您的输入。

你需要的是:

rvm use ruby-1.9.3-p448@global

或:

source "$( rvm ruby-1.9.3-p448@global do rvm env --path )"

调试source

env_file="$( rvm ruby-1.9.3-p448@global do rvm env --path )"
echo "env_file:$env_file:"
source "$env_file"

或使用此脚本:

#!/usr/bin/env rvm-shell ruby-1.9.3-p448@global

rails s