I use Sun Grid Engine, how I can get the id of the last job submitted with qsub?
currently I use this bash alias
alias lastjob="qstat -u $(whoami) |tail -n1| sed '/LOGIN/d'|cut -d' ' -f1"
I use Sun Grid Engine, how I can get the id of the last job submitted with qsub?
currently I use this bash alias
alias lastjob="qstat -u $(whoami) |tail -n1| sed '/LOGIN/d'|cut -d' ' -f1"
Ideally, you should capture the job id from the output of the qsub command:
If you need the last job id later after it is submitted, you can use qstat. It looks like your problem with qstat is caused by "cut" delimiters. The qstat output contains multiple spaces before the job id. Try awk instead.
This works for me: