2

运行时:

    netlogo-headless.sh --model abc.nlogo --experiment experiment --table -

在 Google 云上的 SSH 实例上,我收到错误:-bash:netlogo-headless.sh: command not found

运行上述以“sh”为前缀的内容时,出现以下错误:

    netlogo-headless.sh: 3: netlogo-headless.sh: Bad subsitution
    netlogo-headless.sh: 5: netlogo-headless.sh: [[: not found
    netlogo-headless.sh: 14: netlogo-headless.sh: Syntax error: "(" unexpected

我没有对 netlogo-headless.sh 文件进行任何更改。我在 .profile 和 .bashrc 中设置了 JAVA_HOME 。但是 JAVA_HOME 和 PATH 仍然没有指向 jdk 安装目录。如果这是问题和/或我应该设置其他一些环境变量,有什么想法吗?

当我从 Google Shell 运行该命令时,该命令运行良好。

4

1 回答 1

2

“netlogo-headless.sh: command not found”表示包含该文件的目录netlogo-headless.sh不在您的PATH环境变量中。

最简单的解决方案可能是替换netlogo-headless.sh./netlogo-headless.sh(如果脚本在您当前的工作目录中)或完整的绝对路径。(将包含脚本的目录添加到您的目录PATH也可以,但似乎有点过分了。)

运行脚本sh不起作用,因为是 bash 脚本。替换shbash可能会使其工作。

于 2018-04-06T18:58:13.670 回答