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 #301 background imageLoading...
Page #301 background image
8-33
Cisco Content Services Switch Administration Guide
OL-5647-02
Chapter 8 Using the CSS Scripting Language
Syntax Errors and Script Termination
For example, enter:
! Exit Cleanly
exit script 0
There may be some cases where you want to indicate that a script failed to run
properly. One example of this is when your script requires that a user enter one or
more command line arguments. There is no syntax checking that will prove that
the user supplied the correct arguments, but you can check if the user supplied the
correct number of arguments. For example, enter:
if ${ARGS}[#] “NEQ” “2”
echo “Usage: PingScript \'HostName\'”
exit script 1
endbranch
If this script fails to find exactly two arguments on the command line, it exits with
status code 1 (failure). If you were to check the STATUS variable at this point, it
would be set to a value of 1.
Note All commands in the CLI write an exit code to the STATUS variable after they
execute. If you want to use the STATUS value, you must save it in another variable
or use it right away.
For example, enter:
script play PingScript
echo “Status: ${STATUS}”
echo “Status: ${STATUS}”
The output is:
Usage: PingScript “HostName”
Status: 1
Status: 0
Because the script contains an exit script command with a value of 1, the first
echo command returns a STATUS value of 1 to indicate that the script failed. The
second echo command returns a STATUS value of 0 because the first echo
command executed successfully.

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