EasyManuals Logo
Home>Cisco>Switch>11503 - CSS Content Services Switch

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 #295 background imageLoading...
Page #295 background image
8-27
Cisco Content Services Switch Administration Guide
OL-5647-02
Chapter 8 Using the CSS Scripting Language
Using Command Line Arguments
Using Command Line Arguments
The CLI allows a user to pass command line arguments as quoted text to a script
using the script play command (see “Playing a Script). Use the special reserved
ARGS variable to access the command line arguments that a user passed to a
script.
To print out all the arguments that a user passed to a script, enter:
echo “You passed the arguments: ${ARGS}”
If you want to access each argument individually, you can use the ARGS variable
as an array, where each argument passed on the command line is separated by
spaces. For example, enter:
echo “Your first argument passed is: ${ARGS}[1]”
The script below (called NameScript) prints a user's first and last names. The
script requires that the user pass his/her first and last name (in that order) in
quoted text to the script. For example, enter:
!no echo
if ${ARGS}[#] “NEQ” “2”
echo “Usage: NameScript \'First_Name Last_Name\'”
exit script 1
endbranch
echo “First Name: ${ARGS}[1]”
echo “Last Name: ${ARGS}[2]”
exit script 0
This script first tests to see if the user passed any arguments. If the user did not
pass exactly two arguments, then the script prints usage information to the screen
and exits. If the user passed two arguments, the script assumes that the first
argument is the user’s first name and the second argument is the user’s last name.
Finally, the script prints the user’s first name and last name to the screen.
For example, to play NameScript, enter:
script play NameScript “John Doe”
The output is:
First Name: John
Last Name: Doe

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