我想在工作中传递参数。我在文件 job.sh 中写了一个包装器,但是当我使用它时,出现一个错误:
sbatch: error: This does not look like a batch script. The first
sbatch: error: line must start with #! followed by the path to an interpreter.
sbatch: error: For instance: #!/bin/sh
main.sh
DATE=`date '+%Y-%m-%d %H:%M:%S'`
name='test__'$DATE
./job.sh $name
job.sh
#!/bin/bash
sbatch << EOT
#!/bin/sh
#SBATCH --job-name=$1
#SBATCH --nodes=1 # number of nodes
#SBATCH --ntasks-per-node=1 # number of cores
#module load R
Rscript script.R $1
EOT
脚本R
args <- commandArgs(trailingOnly=TRUE)
print((args[[1]]))
(这三个文件在同一目录中)