This question arises when trying to find a script in my host computing cluster that can allow more convenient management of quantum chemical calculations on Gaussian. The user manual of my host gives the following:Gaussian 09 offers an alternative way of passing to the program values for the number of processors, amount of memory and disk space to use. Instead of specifying %mem, %nprocshared and Maxdisk in input file, you may find more attractive to use the Gaussian environment variables $GAUSS_PDEF, $GAUSS_MDEF and $GAUSS_RDEF. The usage of these variable make it possible to convert the PBS job values for ncpus, mem and jobfs into the environment variables readable by Gaussian 09. We suggest you to try the bash script 'g09.sh' instead of 'g09' in the command line of the PBS script. The script performs this conversion for you and starts the program making it aware of the PBS settings. The syntax of the script usage is simple:Unfortunately, it appears the script does not exist anymore in the cluster (and I cannot fully verify this since as a user, access is not allowed in /root even though I can actually get to the folder / and check /apps and /modules which stores the softwares and the environment modules.This means, I have to based on this information in trying to write my own script that does the same task for me. A typical PBS used by the host looks like this:#!/bin/bash#PBS -l walltime=20:00:00#PBS -l ncpus=4#PBS -l mem=4GB#PBS -l jobfs=100GB#PBS -l software=g09#PBS -l wdmodule load gaussian/g09e01g09 < inputdeck > outputfile 2>&1Therefore, as stated in the PBS Professional User Guide, everything with -l are the resources to be allocated to the job.I then tried to find environment variables that store the value of the resources mem, ncpus and jobfs so I can  export $(some gaussian environment variable)=$(some PBS environment variable correspond to the resources). However the only PBS environmental variable that stores resources is PBS_NCPUS, therefore it seemed the strategy will not workSo, how can I extract the values of each resource type from the PBS directives so I can map them to gaussian environment variables?
How to extract the values of the resources specified in a PBS directive so that they can be mapped into other environment variables?
cluster