Task environment
Task environment functions are used to manage task environment variables.
All task environment functions and procedures act on the EPM environment variables env and runenv.
env and runenv are list variables that contain all of the environment variables that are defined for the current request. env is a read-only variable that contains task information from the initial task request on the submit host. runenv is a modifiable variable that contains the task information that is actually used during task execution on the run host.
env and runenv have the following format:
{"variable-name=value", "variable-name=value", …};
getenv
Description
The getenv() function returns the value of the environment variable that is specified in the name parameter.
Values that are returned by getenv are unaffected by the setenv, keepenv, and unsetenv procedures, because getenv accesses the user’s original, read-only task environment variable information that is stored in the env variable from the client on the submit host.
Syntax
result = getenv (name, value);
Arguments
name | Required. A string that contains the name of a task environment variable. |
value | Optional. A string that contains the value to use if the environment variable name does not exist in env. |
Return values
If the specified task environment variable is found, then result contains its value.
If the specified task environment variable is not found, then the value returns as a string. If value is not specified, then an empty string is returned.
Example
In this example, the value of the environment variable TZ is retrieved from env and stored in result. If TZ is not found, then result is empty.
result = getenv ("TZ");
keepenv
Description
The runenv variable is a list in which each element contains an environment variable. The format of a runenv element is name=value, where name is the name of an environment variable and value is the current value of that variable.
The keepenv procedure modifies the runenv variable so that it contains only the variables that are listed as input parameters. All other environment variables that are stored in the runenv variable are deleted.
keepenv is typically used to limit the set of environment variables that are available to the current task during execution.
Syntax
keepenv (name1, [,name2, …]);
Arguments
name1 | Required. String that contains the name of a task environment variable that should be stored in runenv. |
name2 | Optional. String that contains the name of a task environment variable that should be stored in runenv. |
Return values
Because keepenv is a procedure, no return value is set.
Example
In this example, runenv contains the environment variables TERM, CWD, and PS1. All other environment variables are deleted from runenv.
keepenv ("TERM", "CWD", "PS1");
keystrokeactionprofile
Description
The Advanced Keystroke Action component provides advanced control over remote SSH and Telnet sessions.
Syntax
keystrokeactionprofile="profile";
Arguments
profile
Required
A configured Advanced Keystroke Action profile
Return values
None
Example
keystrokeactionprofile="demo";
setenv
Description
The setenv procedure sets the value of an environment variable in runenv.
Syntax
setenv (name, value);
Arguments
name | Required. String that contains the name of the variable to set in runenv. |
value | Required. String that contains the value of the specified variable. |
Return values
Because setenv is a procedure, no return value is set.
Example
In this example, the SHELL environment variable that is stored in runenv is set to /bin/sh.
setenv ("SHELL", "/bin/sh");
unsetenv
Description
The unsetenv procedure deletes environment variables from runenv.
Syntax
unsetenv (name1 [, name2,…]);
Arguments
name1 | Required. A string or a list of character strings that contain the names of runenv environment variables to delete. |
name2 | Optional. A string or a list of character strings that contain the names of runenv environment variables to delete. |
Return values
Because unsetenv is a procedure, no return value is set.
Example
In this example, the runenv environment variables IFS and USER are deleted.
unsetenv ("IFS", "USER");
Updated 5 days ago