Cisco 11503 Administration Guide - Page 276
Using Variables, Creating and Setting Variables
UPC - 746320664958
View all Cisco 11503 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 276 highlights
Using Variables Chapter 8 Using the CSS Scripting Language Using Variables The CLI supports user-defined variables that you can use to construct commands, command aliases, and scripts. Variables are case-sensitive and can of type integer or character. They can exist as either single elements or arrays of elements. All arrays are of type character, but their elements can be used in integer expressions. For details on arrays, see "Using Arrays" later in this chapter. Within a script, you can create and remove variables. During script termination, the script engine automatically removes script-created variables from memory. You can also create a session variable that allows a variable to remain in the session environment after a script has exited. Additionally, if you save a session variable to a user's profile, the variable will be recreated in the CLI session environment upon login. For details on saving a session variable to a user profile, refer to Chapter 3, Configuring User Profiles. A variable name can contain 1 to 32 characters. Its value is quoted text that normally contains alphanumeric characters. Spaces within the quoted text delineate array elements. Creating and Setting Variables To create a variable and set the variable with a value, use the set command. For example, enter: set MyVar "1" This command sets the variable MyVar to a value of 1. You can also set the variable in memory without a value. For example, enter: set MyVar "" This will set the variable equal to NULL (no value). This is different from a value of 0, which is a value. You can set the variable so that it can be used across all CLI sessions. For example, enter: set MyVar "1" session Saving a variable marked with the session keyword to your user profile allows you to use the variable across CLI sessions. Cisco Content Services Switch Administration Guide 8-8 OL-5647-02