Cisco 11503 - CSS Content Services Switch Administration Manual page 301

Content services switch
Hide thumbs Also See for 11503 - CSS Content Services Switch:
Table of Contents

Advertisement

Chapter 8
Using the CSS Scripting Language
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"
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.
All commands in the CLI write an exit code to the STATUS variable after they
Note
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.
OL-5647-02
echo "Usage: PingScript \'HostName\'"
exit script 1
Syntax Errors and Script Termination
Cisco Content Services Switch Administration Guide
8-33

Advertisement

Table of Contents
loading

This manual is also suitable for:

11500 series

Table of Contents