Example 2
#!/bin/bash
#$ -cwd
#$ -l h_data=2g,h_rt=00:10:00
#$ -j y
#$ -o stdout.$JOB_ID.$TASK_ID
#$ -N ja-loop
#$ -t 1-100:10
for i in `seq 0 9`; do
tid=$((SGE_TASK_ID + i))
echo "SGE_TASK_ID = $SGE_TASK_ID tid=$tid"
done
After the run, there will be 10 output files in the current directory:
$ ls stdout*
stdout.474858.1 stdout.474858.21 stdout.474858.41 stdout.474858.61 stdout.474858.81
stdout.474858.11 stdout.474858.31 stdout.474858.51 stdout.474858.71 stdout.474858.91
$ cat stdout.474858.1
SGE_TASK_ID = 1 tid=1
SGE_TASK_ID = 1 tid=2
SGE_TASK_ID = 1 tid=3
SGE_TASK_ID = 1 tid=4
SGE_TASK_ID = 1 tid=5
SGE_TASK_ID = 1 tid=6
SGE_TASK_ID = 1 tid=7
SGE_TASK_ID = 1 tid=8
SGE_TASK_ID = 1 tid=9
SGE_TASK_ID = 1 tid=10
$ cat stdout.474858.11
SGE_TASK_ID = 11 tid=11
SGE_TASK_ID = 11 tid=12
SGE_TASK_ID = 11 tid=13
SGE_TASK_ID = 11 tid=14
SGE_TASK_ID = 11 tid=15
SGE_TASK_ID = 11 tid=16
SGE_TASK_ID = 11 tid=17
SGE_TASK_ID = 11 tid=18
SGE_TASK_ID = 11 tid=19
SGE_TASK_ID = 11 tid=20
…
$ cat stdout.474858.91
SGE_TASK_ID = 91 tid=91
SGE_TASK_ID = 91 tid=92
SGE_TASK_ID = 91 tid=93
SGE_TASK_ID = 91 tid=94
SGE_TASK_ID = 91 tid=95
SGE_TASK_ID = 91 tid=96
SGE_TASK_ID = 91 tid=97
SGE_TASK_ID = 91 tid=98
SGE_TASK_ID = 91 tid=99
SGE_TASK_ID = 91 tid=100