Cisco 11503 Administration Guide - Page 297
script play, function call, The output is
UPC - 746320664958
View all Cisco 11503 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 297 highlights
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. OL-5647-02 Cisco Content Services Switch Administration Guide 8-29