thanks everyone for the answers. I found a solution that works:
Depending on how the cluster is set up, the Sun Grid Engine might be configured to use another variable name for array ids.. This was the case for me. I found out the variable to use by doing the following:
// job_script.sh
#!/bin/zsh
env >> ~/job_env
set >> ~/job_env
This dumps all environment variables set by the script into a file called job_env. Just simply look in the file and look for a variable array ID that is incremented for each job. Should not be that hard to find.
Remember to submit the job_script.sh with qsub as follows:
qsub -t 1-3 job_script.sh
In my case, the ID that was set was $PBS_ARRAYID. I don't think that's the default so $SGE_TASK_ID should work for standard SGE setups on clusters.
Cheers!