Variable Types - 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
To use a variable, you must supply a variable indicator to allow the CLI to
recognize the variable. The CLI searches each line of text it processes for the
variable indicator "$". The next character must be the left brace character ({)
followed by the variable name. You terminate the variable name with the right
brace character (}). For example, if you want to print your variable to the screen
using the echo command, enter:
set MyVar "CSS11506"
echo "My variable name is: ${MyVar}"
The output is:
My Variable name is: CSS11506

Variable Types

The CLI stores a variable as either type integer or character. The CLI determines
a variable's type by the alphanumeric characters in its value. If any non-numeric
characters are present, the variable's type is character. If all the characters are
numeric, the variable's type is integer.
Arithmetic operations on quoted numbers such as "100" are possible, but are not
possible on variables like "CSS11506" because the CLI knows that "CSS11506"
is not a numeric value. You can retrieve the variable type by appending [*] at the
end of the command string. For example, enter:
set MyVar "CSS11506"
echo "My variable type is ${MyVar}[*]."
set Number "100"
echo "My variable type is ${Number}[*]."
The output from this script is:
My variable type is char.
My variable type is int.
"Int" means integer (numeric with no decimal precision) and "char" means
character (any printable ASCII character). Anything that is not an integer is a
character. A variable that is defined as "3.14" is a character because the CLI does
not consider a period (.) to be a number.
Cisco Content Services Switch Administration Guide
8-9
OL-5647-02

Advertisement

Table of Contents
loading

This manual is also suitable for:

11500 series

Table of Contents