Parameterized Environments

An environment definition may accept parameters. This is useful, for example, to select different versions of some tool.

Parameters are passed to the script either one of syntaxes shown below. The older syntax uses parentheses, which need quoting when used from the shell

In this syntax, parentheses are used:
environmentName(parameter1[,parameter2]...)
In this 'comma' example, parentheses are not used:
environmentName,parameter1[,parameter2]

The parameters are a comma-separated list of tokens that are placed in parentheses after the environment name or after the first comma. No spaces are allowed. Arguments cannot contain commas, spaces, quotes, or other special characters. Proper quoting must be used when switching to a parameterized environment from the command line.

Examples

These examples show how to add a parameterized environment. The two pairs of lines have the same effect.
% ves '+D(DISPLAY=tahoe:0.0)'
% ves '+D,DISPLAY=tahoe:0.0'
% ves '+SYNOPSYS(1998.08)'
% ves '+SYNOPSYS,1998.08'

From inside the environment script, the parameters are accessible by means of the variable '$argv' in C-shell or the list $argv in Tcl. Parameters are passed to both the start.tcl script, and the end.tcl script.

For example, this is the definition of the standard environment D:
# This is D.start.tcl
# An environment to define variables.
# Usage: ves +D,VAR1=value,VAR2=value,...
foreach arg $argv {
    if [regexp {([^=]+)=(.*)} $arg all var value] {
        setenv $var $value  
        lappend env(D_env_vars) $var
    } 
}
Multiple environment variables can be set while launching a job using D using parentheses, like this:
% nc run -e "D(VOV_LIMIT_maxproc=8192,VOV_LIMIT_openfiles=8192)" env
Multiple environment variables can also be set for individual jobs by using the comma notation without parentheses and without quotes.
% nc run -e D,VOV_LIMIT_maxproc=8192,VOV_LIMIT_openfiles=8192 env
Inside a jobclass definition file, a parametrized environment can be specified like this:
set VOV_JOB_DESC(env) "SNAPSHOT+D,VOV_LIMIT_maxproc=8192,VOV_LIMIT_openfiles=8192"
Curly braces are also supported in the use of environment variables. This permits the use of commas, among other special characters. For example:
nc run -e 'D(FOO={value,with,commas},BAR=normal_value)' ...

and

ves 'D(FOO={bar,baz})'
Another example:
set VOV_JOB_DESC(env) "SNAPSHOT+D,VOV_LIMIT_maxproc=8192,MY_CSV_VAR={a,b,c},VOV_LIMIT_openfiles=8192"