'How to use a variable to define bsub jobname?
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?
Solution 1:[1]
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).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tripleee |
