Using Arithmetic Operators - Cisco 11503 - CSS Content Services Switch Administration Manual

Content services switch
Hide thumbs Also See for 11503 - CSS Content Services Switch:
Table of Contents

Advertisement

Chapter 8
Using the CSS Scripting Language
Using Variables
Example 3:
set MyVar1"1"
set Myvar2 "2"
set MyVar1 "${MyVar2}"
You can also apply the set and no set commands to character variables.
Note

Using Arithmetic Operators

To change the value of a variable with arithmetic operators (-, +, /, *, or modulus),
use the modify command . For example, enter:
set MyVar "100"
modify MyVar "+" "2"
echo "Variable value is ${MyVar}."
modify MyVar "-" "12"
echo "Variable value now is ${MyVar}."
modify MyVar "*" "6"
echo "Variable value now is ${MyVar}."
modify MyVar "/" "6"
echo "Variable value now is ${MyVar}."
modify MyVar "MOD" "10"
echo "Variable modulus value now is ${MyVar}"
The output is:
Variable value is 102.
Variable value now is 90.
Variable value now is 540.
Variable value now is 90.
Variable modulus value now is 0.
For simple arithmetic operations, the modify command takes an operator in
quotes (for example, "/", "*", "+", "-", or "MOD") and a new value in quotes. This
value does not have to be a constant (for example, "5" or "10"), but can be another
variable (for example, "${Var1}" or "${Var2}"). The modulus operator "MOD"
divides the variable by the specified value (in the above example "10") and sets
the variable value to the remainder.
The following sections describe additional operations you can perform on
variables using the modify command. For more information on the modify
command, refer to the Cisco Content Services Switch Command Reference.
Cisco Content Services Switch Administration Guide
8-11
OL-5647-02

Advertisement

Table of Contents
loading

This manual is also suitable for:

11500 series

Table of Contents