How to get system environment variable in user process

I submit a job (for example one shell script), I use the environment variable directly in the shell script, but cannot find it, I need do one of the following way:
1, in script, need ‘source profile’
2, qsub -V = …

are there any easy way to passthrough the system environment variable to user process of job? thanks!

#To set and export specific environment variables
qsub -v VAR1=test1,VAR2=test2,VAR3=test3 – /bin/sleep 100

#To export everthing that is set in the systems environment
qstat -V – /bin/sleep 1000 ( Capital “V” is used )

you can use in a bash script using PBS directives



#PBS -v VAR1=test1,VAR2=test2

man page for qsub would have more information.

Thank you

1 Like

thanks for your response

1 Like