Understanding the Command-Line Interface
Configuring CLI Session-Only Variables
You can define CLI session variables to persist only for the duration of your CLI session. These variables are
useful for scripts that you execute periodically. You can reference the variable by enclosing the name in
parentheses and preceding it with a dollar sign ($), for example $(variable-name).
Procedure
Step 1
Step 2
Configuring Persistent CLI Variables
You can configure CLI variables that persist across CLI sessions and device reloads.
Procedure
Step 1
Step 2
Command or Action
cli var name variable-name
variable-text
Example:
switch# cli var name
testinterface ethernet 2/1
show cli variables
Example:
switch# show cli variables
Command or Action
configure terminal
Example:
switch# configure terminal
switch(config)#
cli var name variable-name variable-text
Example:
switch(config)# cli var name
testinterface ethernet 2/1
Cisco Nexus 9000 Series NX-OS Fundamentals Configuration Guide, Release 7.x
Configuring CLI Session-Only Variables
Purpose
Configures the CLI session variable. The variable-name
argument is alphanumeric, case sensitive, and has a maximum
length of 31 characters. The variable-text argument is
alphanumeric, case sensitive, can contain spaces, and has a
maximum length of 200 characters.
Beginning with Cisco NX-OS Release 7.0(3)I4(1),
Note
variables can include hyphens (-) and underscores
(_).
(Optional)
Displays the CLI variable configuration.
Purpose
Enters global configuration mode.
Configures the CLI persistent variable. The variable
name is a case-sensitive, alphanumeric string and
must begin with an alphabetic character. The
maximum length is 31 characters.
Beginning with Cisco NX-OS Release
Note
7.0(3)I4(1), variables can include hyphens
(-) and underscores (_).
55