In UNIX, you specify environment variables to define the local environment the script runs in. You can modify existing environment variables or create your own.
To pass an environment variable to a script, specify the ENVAR statement in the job definition. You can specify multiple ENVAR statements in a UNIX job definition.
Example: Pass UNIX Environment Variables to a Script
This example includes two ENVAR statements that pass environment variables to a script and a third ENVAR statement that defines the Present Working Directory (PWD). The parameter "user 1" is enclosed with double quotation marks because it contains a space.
SCRIPTNAME /home/scripts/pay AGENT UNIX_NY ENVAR NAME="user 1" ENVAR JOB=PAYROLL ENVAR PWD=/usr/scripts/dailyrun
In this example, the pay script can reference these variables:
|
Environment Variable |
Value Passed |
|---|---|
|
NAME |
user 1 |
|
JOB |
PAYROLL |
|
PWD |
/usr/scripts/dailyrun |
|
Copyright © 2013 CA Technologies.
All rights reserved.
|
|