With the Sun Grid Engine, how can I get the directory where the job script is located, within the job script?
I need this so I can start the script with
cd script-location
to make sure it'll have access to all the necessary files. So far I have hard-coded the script directory into each script, which makes it much too easy to make mistakes.
script-location
should ensure you change to the right directory, regardless of your working directory when the script starts (you're already doing this). Is that what you're looking for? I typically code in paths using environment variables, if possible, to make hacking scripts easy. $\endgroup$ – Geoff Oxberry Apr 19 '13 at 16:06