To be a bit more SGE specific than the accepted answer, just redirect the standard output of qsub
and parse the job id. You can then use this to alter the job name via qalter
.
Here's a sample of a script I used to submit and modify jobs like this.
for a in $args;
do
qsub submission_script $a 1> job.txt
jid=$(cat job.txt | tr -dc '0-9' | cut -c -6)
qalter $jid -N $a
done
I'm certain that there are more idiomatic ways to do this, but this is a first go.
This approach allows submission_script
to have it's own arguments. It also allows you to programmatically alter other job characteristics, not just the name.