Chapter 8 Using the CSS Scripting Language
Using Arrays
8-22
Cisco Content Services Switch Administration Guide
OL-5647-02
For example, enter:
show variable
The output is:
$MODE = super
$LINE = console
$CHECK_STARTUP_ERRORS = 1 *Session
$UGREP = Weight: 1 Load: 255
$SOCKET = -1
$USER = admin
$STATUS = 0
Notice in this example that there are several variables already defined in the
environment. You can also display a specific variable by invoking the
show
variable
command with a parameter that represents the variable name you want
to see.
For example, enter:
show variable LINE
The output is:
$LINE = console
Using Arrays
A variable can hold subvalues (elements) within its memory space. Such a
variable is commonly called a variable array or just an array. An array can hold
numeric values, strings, or both. To create an array, simply create a variable using
the
set
command and separate all of the array elements by spaces. For example,
enter:
set WeekDays “Sun Mon Tues Wed Thurs Fri Sat”
You can print the array like any other variable. For example, enter:
echo “Days of the week: ${WeekDays}.”
The output is:
Days of the week: Sun Mon Tues Wed Thurs Fri Sat.