Suppose that I have the following simple bash script which I want to submit to a batch server through SLURM:
#!/bin/bash
#SBATCH -o \"outFile\"$1\".txt\"
#SBATC
This is an old question but I just stumbled into the same task and I think this solution is simpler:
Let's say I have the variable $OUT_PATH
in the bash script launch_analysis.bash
and I want to pass this variable to task_0_generate_features.sl
which is my SLURM file to send the computation to a batch server. I would have the following in launch_analysis.bash
:
`sbatch --export=OUT_PATH=$OUT_PATH task_0_generate_features.sl`
Which is directly accessible in task_0_generate_features.sl
In @Jason case we would have:
sbatch -D `pwd` --export=hostname=$hostname exampleJob.sh
Reference: Using Variables in SLURM Jobs