具体代码如下:
# 返回ls的输出
s=`ls`
cmd= "ls"
s= `#{cmd}`
# 返回true or false
s= system('ls')
cmd= 'ls'
s= system(cmd)
#返回输出
s= %x[uptime]
#用top进程替换当前ruby进程
exec "top"
cmd = 'top'
exec cmd
make的时候需要调用ruby很多编译前的参数.一些信息make不知道的话会不知道如何建库.我个人的建议是根据你安装的ruby路径和版本信息把配置选项补充全.下面是我电脑上面的配置,你可以借鉴一下.据我分析应该能解决你的问题.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/usr/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/ruby-2.1.2/rubies/ruby-2.1.2/bin/ruby