Platform LSF Administration Guide Version 6.2

Passing Arguments on the Command Line
Administering Platform LSF
420
Passing Arguments on the Command Line
The environment variable LSB_JOBINDEX is used as a substitution string to support
passing job array indices on the command line. When the job is dispatched, LSF sets
LSB_JOBINDEX in the execution environment to the job array index of the current
job. LSB_JOBINDEX is set for all jobs. For non-array jobs, LSB_JOBINDEX is set to
zero (0).
To use LSB_JOBINDEX, all the input files must be named consistently and with a
variable part that corresponds to the indices of the job array. For example:
input.1, input.2, input.3, ..., input.N
You must escape LSB_JOBINDEX with a backslash, \, to prevent the shell interpreting
bsub from expanding the variable. For example, the following command submits a job
array of 1000 jobs whose input files are named
input.1, input.2, input.3, ...,
input.1000 and located in the current working directory. The executable is being
passed an argument that specifies the name of the input files:
% bsub -J "myArray[1-1000]"
myJob -f input.\$LSB_JOBINDEX