Is it possible to have vars in a slurm preamble?
06:57 09 Apr 2026

Is it possible to set vars before the preamble of a slurm file? Is preamble the right word? I mean the part where the SBATCH directives are . . . Anyway, is it possible to do something like this?

#!bash

NODE_NUM=$(echo -n $HOSTNAME | tail -c 1)

#SBATCH --output=logs/job_notebook_${NODE_NUM}.out 
.
.
.

Or do I need to move that stuff to the commandline when I submit? Or dynamically create the slurm file?

Thanks!

slurm