EasyManuals Logo

Cisco 11503 - CSS Content Services Switch User Manual

Cisco 11503 - CSS Content Services Switch
392 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #296 background imageLoading...
Page #296 background image
Chapter 8 Using the CSS Scripting Language
Using Functions
8-28
Cisco Content Services Switch Administration Guide
OL-5647-02
Using Functions
Functions provide a way to organize your scripts into subroutines or modules. You
can then call these functions as your script requires them.
To modularize your scripts both for ease of reading and simplification, use the
function command. This command allows both the creation and calling of script
functions. For example, enter:
echo “Calling the PrintName function”
function PrintName call
echo “End”
! Function PrintName: Prints the name John Doe
function PrintName begin
echo “My Name is John Doe”
function PrintName end
The output is:
Calling the PrintName function
My Name is John Doe
End
Notice that the command issued between the commands function PrintName
begin and function PrintName end executes before the last echo statement in the
script. Also note that the script automatically terminates after the last valid line
before the function definition.
Passing Arguments to a Function
You can pass a list of arguments to a function. (This is similar to passing command
line arguments to a script.) You can also use those arguments when the script calls
the function. For example, enter:
echo “Calling the PrintName function”
function PrintName call “John Doe”
echo “End”
! Function PrintName: Prints the name John Doe
function PrintName begin
echo “My Name is ${ARGS}”
function PrintName end
The output is:

Table of Contents

Other manuals for Cisco 11503 - CSS Content Services Switch

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Cisco 11503 - CSS Content Services Switch and is the answer not in the manual?

Cisco 11503 - CSS Content Services Switch Specifications

General IconGeneral
BrandCisco
Model11503 - CSS Content Services Switch
CategorySwitch
LanguageEnglish

Related product manuals