Exiting A Script Within Another Script; Using The Grep Command - Cisco 11503 - CSS Content Services Switch Administration Manual

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

Advertisement

Using the grep Command

Exiting a Script Within Another Script

Using the grep Command
Cisco Content Services Switch Administration Guide
8-34
It is possible to play a script from another script using the function
SCRIPT_PLAY. For details on playing a script, see
Function"
earlier in this chapter. In this case, be careful when dealing with the exit
script command in the secondary script.
If script A invokes script B and script B issue an exit script command, both scripts
will exit. Therefore, it is important that a script calling another script either
removes any exit script commands in the second script or makes other
arrangements to handle this behavior.
To search for specified data and place the last line of the search results in a
variable called UGREP, use the grep command with the -u option. For example,
to create a script to search for the Keepalive field in the show service command
on a service called S1, enter:
!no echo
show service S1 | grep -u "Keepalive"
echo "The line is: ${UGREP}"
The output is:
The line is: Keepalive: (SCRIPT a-kal-pop3 10 3 5)
Because the show service screen contains the field Keepalive, the entire line is
stored in the UGREP variable. You can also extract each space-separated element
by treating the UGREP variable as an array. For example, to extract the first block
of text, enter:
!no echo
show service S1 | grep -u "Keepalive"
echo "The first element in the line is: ${UGREP}[1]"
The output is:
The first element in the line is: Keepalive:
Chapter 8
Using the CSS Scripting Language
"Using the SCRIPT_PLAY
OL-5647-02

Advertisement

Table of Contents
loading

This manual is also suitable for:

11500 series

Table of Contents