set var

set var varname _expression
Note

Note

This is a script command and operates only in scripts or on the command line when scripting is enabled with the following command: enable cli scripting {permanent}.

Description

Creates and sets the CLI scripting variable to the desired value.

Syntax Description

varname Specifies the name of the CLI scripting variable. Valid format is $VARNAME (case insensitive, character string up to 32 characters).
_expression Specifies the _expression whose value should be evaluated and used to set the variable.

Default

N/A.

Usage Guidelines

The format of a local variable (case insensitive) is: $VARNAME.

An error message is displayed if the user attempts to use a variable name with a length greater than 32 characters.

If a variable already exists, it is overwritten. No error message is displayed.

Example

The following examples show some ways you can manipulate variables:

Set var x 100
Set var x ($x + 2)
Set var y ($x - 100)
Set var y ($(x) – 100)

History

This command was first available in ExtremeXOS 11.6.

Platform Availability

This command is available on ExtremeSwitching 5320, 5420, 5520, and 5720 series switches.