google-cloud-platformnetlogobehaviorspace

netlogo-headless.sh does not run on SSH instance on Google cloud


When running:

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

on an SSH instance on Google cloud, I get the error: -bash:netlogo-headless.sh: command not found

When runnning the above prefixed by 'sh', I get the following errors:

    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

I have not made any changes to the netlogo-headless.sh file. I have set JAVA_HOME in .profile and .bashrc . However, JAVA_HOME and PATH still do not point to the jdk installation directory. Any ideas if this is the problem and/or there some other environment variables I should be setting?

The command runs fine when I run it from Google Shell.


Solution

  • "netlogo-headless.sh: command not found" indicates that the directory containing the file netlogo-headless.sh isn't in your PATH environment variable.

    The simplest solution would probably be to replace netlogo-headless.sh with ./netlogo-headless.sh (if the script is in your current working directory) or with a full absolute path. (Adding the directory containing the script to your PATH would work too, but seems like overkill.)

    Running the script with sh won't work because is bash script. Replacing sh with bash would probably make it work.