【问题标题】:Executing a command line执行命令行
【发布时间】:2013-06-08 01:42:54
【问题描述】:

我想在我的 siriproxy 服务器中添加一些线路,以便能够使用 x10 cm19a 控制我的家庭自动化系统。

我找到了我的命令行让它工作,当我在终端中运行它时,一切正常:

karl@karl:~$ ./x10cmd rf a5 off

我尝试在执行此操作时将此行添加到我的 siriproxy 脚本中:

  listen_for /turn the bedroom light on/i do
    exec('./x10cmd rf a5 on')
    say "i turn your light on"

    request_complete

它正在工作,但它阻止了我的 siriproxy 运行,所以我尝试了:

  listen_for /turn the bedroom light on/i do
    `ls ./x10cmd rf a5 on`
    say "i turn your light on"

    request_complete

  listen_for /turn the bedroom light on/i do
    system('ls ./x10cmd rf a5 on')
    say "i turn your light on"

    request_complete

但没有任何效果。它一直在说:

ls 找不到目录。

你能帮忙吗?

【问题讨论】:

    标签: ruby siri


    【解决方案1】:

    在您的第二次和第三次尝试中,您的命令行开头有一个ls

    【讨论】:

    • 扩大答案,ls ./x10cmd rf a5 on 在两次尝试中都是违规行。那是因为ls 命令找不到名为./x10cmd 的文件或目录。删除ls 以解决问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-05
    • 2012-07-15
    • 2017-07-04
    • 2019-04-20
    • 2011-06-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多