bash - immediately catching that not all environment variables have been defined on qsub command line -
I am using qsub to submit PBS jobs. 5 environment variables should be defined in my job file: qsub -v A = foo, B = bar, C = cat, D = dog, E = qux jobfile.sh . Occasionally, I can forget to define a variable on the command line when I submit it only to find out my error.
So, one way of catching this situation is that all the environment variables are not defined when submitting from qsub ? Or do I have to admit that I have to be very careful when depositing job files with very important environmental variables?
Thank you,
Paul
Best of you You can add a runtime check to the beginning of jobfile.sh to exclude if there are no expected variables set.
set -u: $ A $ B $ C $ D $ E set + U set-u to shell Asks to exit if an unsetset parameter is attempted to increase : The command does nothing, but its debate first passes in standard detail, so if any of the five If not set, shell will exit. set + u then disables unset-parameter checks for the remainder of the balance.
qsub can not examine the given task to determine whether this variable is what it is.
Comments
Post a Comment