Question

I'm submitting a bunch of qsub jobs that take a range of parameter values. I run the following loop to submit these multiple jobs. I pass the specific parameter values to qsub through -v. I would like the jobname to also be a function of these parameters:

#!/bin/bash    
for a in 1 2
do
  for b in 1 2
  do
  echo "a is $a, b is $b"
      qsub -v a=$a,b=$b -N run_$a_$b run_file.sh
  done
done

Where the run_file.sh contains the #PBS commands to run the program. When I submit to the server I see the following output that shows the loop is working correctly:

a is 1, b is 2

But the job name appears only with the last parameter

run_$b (i.e. run_2 for $b=2)

Instead of as

run_$a_$b

How can I get the jobname to include both parameters? I have tried shortening the file name to confirm it's not a length issue. I would like the name to appear with both parameters to keep track of which files are still running without needing to check the output files. Thanks for any help.

Was it helpful?

Solution

Can't really run this script but try: qsub -v a=$a,b=$b -N run_${a}_${b} run_file.sh

hope this is what you were looking for

OTHER TIPS

in run_$a_$b bash consider $a_ as one variable and apparently you do not have a_ defined something like this should work? run_${a}_$b

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top