Slurm - 模糊重定向

Slurm - ambiguous redirect

我不确定我的 slurm 脚本有什么问题 - 我收到的错误消息是我的 $input 的模糊重定向和我尝试定义变量时找不到的命令。

#!/bin/bash
#SBATCH --job-name=gim
#SBATCH --time=24:00:00
#SBATCH --ntasks=20
#SBATCH --ntasks-per-node=2
#SBATCH --cpus-per-task=1
#SBATCH -o output_%A_%a.out #Standard Output
#SBATCH -e output_%A_%a.err #Standard Error

module load program

input= gim${SLURM_ARRAY_TASK_ID}.gjf
output= gim${SLURM_ARRAY_TASK_ID}.log

program $input > $output

我运行的方式是:

sbatch --array=1-500 ./slurm.job

空格很重要:

#!/bin/bash
# ...etc...

input=gim${SLURM_ARRAY_TASK_ID}.gjf
output=gim${SLURM_ARRAY_TASK_ID}.log

program "$input" > "$output"

请注意作业的 = 符号周围没有空格。空格很重要:

foo = bar # this runs "foo" with "=" as the first argument and "bar" as the second
foo =bar  # this runs "foo" with "=bar" as its first argument
foo= bar  # this runs "bar" as a command with "foo" as an empty string in its environment
foo=bar   # this assigns the value "bar" to the shell variable "foo"