Sample Header Ad - 728x90

Passing Argument to Comment in .sh script

3 votes
2 answers
8632 views
I am a beginner in the use of .sh scripts so please excuse my ignorance. This is my problem: To submit my jobs to our cluster the corresponding submit file has to contain a "slurm header" and looks something like this. #!/bin/sh # ########## Begin Slurm header ########## # #SBATCH --job-name=blabla # ########### End Slurm header ########## # Load module module load math/matlab/R2020a # Start a Matlab program matlab -nodesktop -r "program $1 $2" exit Notice that I am passing two arguments to this .sh file which are then passed on to the matlab program. How can I make the job-name in the Slurm header dynamic according to the input arguments? Simply writing #SBATCH --job-name=blabla$1$2 predictably doesn't work.
Asked by stollenm (133 rep)
Sep 17, 2021, 09:10 AM
Last activity: Sep 21, 2021, 11:05 AM