【问题标题】:Getting the value of a system call [duplicate]获取系统调用的价值[重复]
【发布时间】:2015-07-23 19:09:59
【问题描述】:

我正在尝试从 Ruby 中的系统调用中获取值:

distro = system('lsb_release -is')
distver = system('lsb_release -rs | cut  -c1-2')

我认为lsb_release 的返回值进入了变量。但是,如果我是 puts distroputs distver,那我就说对了。

有没有办法从他们那里获得价值?

【问题讨论】:

标签: ruby system-calls


【解决方案1】:

你可以去

d = `date`
e = IO.popen("date").read

也花点时间与IO.popenIO.popen2IO.popen3

【讨论】:

    猜你喜欢
    • 2019-01-27
    • 2012-09-19
    • 2014-01-31
    • 2016-03-26
    • 2017-11-01
    • 2017-10-19
    • 1970-01-01
    • 2015-01-11
    • 2020-07-20
    相关资源
    最近更新 更多