Problem


When submitting jobs, I get the following error:

sbatch: error: This does not look like a batch script.
sbatch: error: The first line must start with #! followed by the path to an interpreter.
sbatch: error: For instance: #!/bin/sh

Solution


The sbatch command expects a SLURM submit file to work with. Be sure that:

  • The script starts with a shebang followed by the path to an interpreter. For example #!/bin/bash.
  • If the script has been generated using a machine that uses Windows, be sure that the script does not have not unix end of lines:
    1. Open your file with an text editor as a binary file. For example, in vi/vim:

      vim -b script.slm
    2. If the characters ^M are present at the end of the lines, a converstion to unix files must be perform.

    3. Use the dos2unix command to transform the script.

      dos2unix script.slm