I would like to pass numeric variables to a PBS script, specially for the job name -N. This topic discusses about that, but it is not clear how to pass the variable to the PBS directives. For example, I would like to have something like this
ids=(1 3 5)
for i in "${ids[@]}"; do
#PBS -l nodes=1:ppn=1
#PBS -V
#PBS -N my_job_$i <=== my_job_1, my_job_3, my_job_5
cd $PBS_O_WORKDIR
./run_program file-$i.txt
done
The command file-$i.txt is fine, but the output job names are not what I expect. It just literally writes my_job_$i. How can I fix that?