Slurm - 模糊的重定向

时间:2016-07-13 22:33:49

标签: bash slurm

我不确定我的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

1 个答案:

答案 0 :(得分:2)

空白很重要:

#!/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"