It seems that I cannot use ./ in qsub as in

qsub -q hpc-pool ./myScript.sh

where myScript.sh contains several ./.

After checking, ./ somewhat is translated to ~/. Why is this the case?


Batch jobs submitted by qsub are executed in your home directory by default.

Some versions of qsub support the -d option to specify a different directory. To execute the script in the same directory where you ran qsub, use

qsub -d "$PWD" -q hpc-pool ./myScript.sh

If the -d option is not available, you can access the directory where you ran qsub in your script, in the PBS_O_WORKDIR variable. So add this line near the beginning of your script:

cd "$PBS_O_WORKDIR" || exit $?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.