Chapter 8 Using the CSS Scripting Language
Using Variables
8-12
Cisco Content Services Switch Administration Guide
OL-5647-02
Using the Increment and Decrement Operators
The scripting language provides two operators for incrementing and decrementing
variable values. The increment operator “++” adds 1 to the variable value and the
decrement operator “--” subtracts 1 from the variable value. Use these operators
with the modify command.
For example, enter:
set MyVar “1”
echo “Variable is set to ${MyVar}.”
modify MyVar “++”
echo “Variable is set to ${MyVar}.”
modify MyVar “--”
echo “Variable is set to ${MyVar}.”
The output is:
Variable is set to 1.
Variable is set to 2.
Variable is set to 1.
These two operators make it possible to add or subtract a value without having to
type an addition modification command. So you can replace:
modify MyVar “+” 1
With:
modify MyVar “++”
Note Both the increment and the decrement operators work only with integer variables.
If you use them with character variables, such as “CSS11506”, an error occurs.