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 #294 background imageLoading...
Page #294 background image
Chapter 8 Using the CSS Scripting Language
Capturing User Input
8-26
Cisco Content Services Switch Administration Guide
OL-5647-02
Capturing User Input
To capture user input in a variable, use the input command. You can use this
command to create a script to assist users in setting up configuration files or
preparing a CSS in some predefined way. For example, enter:
! Ask the user for his/her full name
echo “What is your full name?”
input FULL_NAME
echo “Hello ${FULL_NAME}!”
In the example above, notice that the input command has a variable argument
called FULL_NAME. Notice that you do not need to set FULL_NAME prior to
the input command. The command creates the variable and fills it with the data
that the user supplies. Also, note that the user’s input is terminated by a carriage
return.
A user can enter any alphanumeric characters. If a user presses only the Enter key
and does not type any characters, then the script creates the variable with a NULL
value. This allows you to test the user input to verify that the user typed
something. In the following example, the script continues to ask the user the same
question until the user types “y”.
echo -n “\please enter the character 'y' to exit.”
input DATA
while DATA “NEQ” “y”
echo -n “Please enter the character 'y' to exit: “
input DATA
echo “\n”
endbranch
In the example above, notice the use of the echo command with the -n parameter.
This allows you to prompt the user with a message without forcing a new line at
the end of the sentence so that the user’s data appears on the same line as the echo
command output. In the echo command quoted string, you can embed “\n”, a
C-programming style character that puts a line feed in the output to make it more
readable.

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