Cisco 11503 - CSS Content Services Switch Administration Manual page 297

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 Functions
Calling the PrintName function
My Name is John Doe
End
Notice that the script uses the ARGS variable to hold the passed arguments. Just
as command line arguments work with the script play command, function
arguments work with the function call command.
If you pass command line arguments to a script in the script play command and
use function arguments in the script, then the ARGS variable is stored until the
function returns from its execution.
For example, suppose you pass two arguments "Billy Bob" to a script using the
script play command and the script calls a function called PrintName with
different arguments, enter:
echo "I was passed the arguments ${ARGS}"
function PrintName call "John Doe"
echo "The original arguments are ${ARGS}"
! Function PrintName: Prints the name John Doe
function PrintName begin
echo "My Name is ${ARGS}"
function PrintName end
The output is:
I was passed the arguments Billy Bob
My Name is John Doe
The original arguments are Billy Bob
Although you use the ARGS variable twice in this script, ARGS had two different
values because the function call held its own ARGS variable value independently
of the main script's ARGS variable value.
Now you can modularize your scripts for easier reading and maintenance.
Cisco Content Services Switch Administration Guide
8-29
OL-5647-02

Advertisement

Table of Contents
loading

This manual is also suitable for:

11500 series

Table of Contents