I do not know the maximum number of jobs a priori. So when I keep it a variable:
#!/bin/bash
caselist=/my/caselist.txt
N=`cat $caselist | wc -l`
#BSUB -J myjob[1-$N]
...
...
(I call the above script myjob.lsf
)
And submit the job as bsub < myjob.lsf
, I get:
Bad job name. Job not submitted.
So is there a way I can use a variable in #BSUB -J myjob[1-$N]
within myjob.lsf
?
The code inside the file does not get evaluated when you pass it to bsub
. You can probably remove it from the script entirely, and instead submit it differently.
bsub -J "myjob[1-$(wc -l </my/caselist.txt)]" <myjob.lsf
(speculating a bit about the bsub
options; the manuals I could find online were rather bad).