Variable names must be followed by white space or otherwise enclosed in parentheses.
For example: create vlan v($X)e where X is the variable. The variable created will persist through the session and will not get reset after disable/enable cli scripting.
Predefined System Variables shows the predefined system variables that are always available for use by any script. Predefined variables are automatically set up for use before a script or profile is executed.
Note
You must enable CLI scripting before using these variables or executing a script.Variable Syntax | Definition |
---|---|
$STATUS |
Status of last command execution. Values -100 to 100 are reserved and automatically set by the software, but you can override the value with the command return statusCode . Common values are: 0—Successful command completion-53—Variable not found-57—WHILE depth exceeded 78—Script timeout |
$CLI.USER | User who is executing this CLI. |
$CLI.SESSION_TYPE | User session type. |
$CLI.SCRIPT_TIME_ REMAINING |
When a script timeout value is configured with the configure cli script timeout timeout command, the system creates this variable, which returns the following values (in seconds): If no script is running, this variable returns the configured timeout value. If a script is aborted due to timeout, this variable returns the value 0. If a script finishes execution (before the timeout value is reached), this variable returns the remaining time. |
$CLI.SCRIPT_TIMEOUT | When a script timeout value is configured with the configure cli script timeout timeout command, the system creates this variable, which returns the current timeout value. If no script is running, this variable returns the configured timeout value. |
System Variables that Must Be Created shows the system variables that you must define before use.
Variable Syntax | Definition |
---|---|
$CLI.OUT |
Output of last show command. The maximum size of this variable is 1 MB. This output can be used for operations such as match and regexp. For more information on these operations, see Using Built-In Functions. You must define this variable before it is used. To define this variable, enter either of the following statements: set var CLI.OUT " " set var CLI.OUT 0 We recommend that you delete this variable after each use. |