Note
This is a script command and operates only in scripts when scripting is enabled with the following command: enable cli scripting {permanent}.
Executes a code block while the specified condition is true.
expression | Specifies the condition for which the statements should be executed while the condition is true. |
statements | Set of statements to be executed while the condition is true. |
N/A.
This command is usually followed by statements to be executed while the condition is true and the entire construct is terminated by an ENDWHILE command.
The _expression must be enclosed in parentheses.
Nesting is supported up to five levels. An error message is displayed if there is incorrect nesting of WHILE conditions. An error message is displayed if a user tries to execute more than five WHILE conditions.
Ctrl-C can be used to break out of a WHILE loop(s). Breaking out of any number of WHILE loops always clears all the WHILE loops .
The operators mentioned in Using Operators can be used in an _expression in a WHILE condition.
You can insert comments by using a number sign (#).
set var x 1 WHILE ($x <= 10) DO create vlan v$x set var x ($x + 1) ENDWHILE
This command was first available in ExtremeXOS 11.6.
This command is available on ExtremeSwitching X435, X440-G2, X450-G2, X460-G2, X465, X590, X620, X670-G2, X690, X695, X870, 5320, 5420, and 5520 series switches.