1

I have seen similar questions, but not exactly the same as mine: Use Bash variable within SLURM sbatch script, because I am not talking about slurm parameters.

I want to launch a slurm job for each of my sample files, so imagine I have 3 vcfs and I want to run a job for each of them:

I created a script to loop through a file in which I wrote sampleIds to run another script with each sample, which would perfectly work if I wanted to run it directly with bash:

while read line
do

sampleID="${line[0]}"

myscript.sh $sampleID

The problem is that I need to run the script with slurm, so is there any way to indicate slurm the bash variable that it should include?

I was trying this, but it is not working:

sbatch myscrip.sh --export=$sampleID
Jeni
  • 918
  • 7
  • 19

1 Answers1

1

Okay, I've solved it:

sbatch --export=sampleID=$sampleID myscript.sh
Jeni
  • 918
  • 7
  • 19