【问题标题】:Run custom external command from scala从 scala 运行自定义外部命令
【发布时间】:2016-12-25 10:47:28
【问题描述】:

我正在尝试将 torch 与 scala 集成。

我有以下 bash 脚本 (foo.sh):

#!/bin/bash
echo hello world
th *rest of command*

我尝试在 scala 中执行它以获得一些输出:

"./foo.sh" !!

但是它给了我一个错误:

第 42 行:th:找不到命令

有什么办法可以让这个工作正常吗?

【问题讨论】:

  • 我建议将完整路径添加到th
  • @Cyrus 圣莫莉,我花了太多时间来完成这项工作。如果您将此作为答案发布,我会接受。

标签: bash scala scripting path torch


【解决方案1】:

我建议添加th 的完整路径。

【讨论】:

    【解决方案2】:

    你有安装手电筒吗? 如果是,试试这个:

    #!/bin/bash
    source ~/.profile
    source ~/.bashrc
    echo hello world
    th *rest of command*
    

    或者更好地使用完整路径运行th。完整路径可通过命令获取:

    type th
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-25
      • 2011-09-09
      • 2011-11-24
      相关资源
      最近更新 更多