Cisco Nexus 5000 Series Switch CLI Software Configuration Guide, NX-OS 4.0(1a)N1 (OL-16597-01, January 2009)

Send feedback to nx5000-docfeedback@cisco.com
2-11
Cisco Nexus 5000 Series Switch CLI Software Configuration Guide
OL-16597-01
Chapter 2 Using the Command-Line Interface
Command Scripts
The following example shows how to display the command aliases defined on the switch:
switch# alias
CLI alias commands
==================
alias :show cli alias
gigint :interface gigabitethernet
shintbr :show interface brief
shfcintup :shintbr | include up | include fc
Command Scripts
This section includes the following topics:
Executing Commands Specified in a Script, page 2-11
Using CLI Variables in Scripts, page 2-12
Setting the Delay Time, page 2-13
Executing Commands Specified in a Script
The run-script command executes the commands specified in a file. To use this command, be sure to
create the file and specify commands in the required order.
Note You cannot create the script file at the switch prompt. You can create the script file on an external
machine and copy it to the bootflash: directory. This section assumes that the script file resides in the
bootflash: directory.
The syntax for this command is run-script filename.
This example displays the CLI commands specified in a test file that resides in the bootflash: directory.
switch# show file bootflash:testfile
configure terminal
interface fc 3/1
no shutdown
end
show interface fc 3/1
This file output is in response to the run-script command executing the contents in the test file:
switch# run-script bootflash:testfile
'configure terminal'
Enter configuration commands, one per line. End with CNTL/Z.
'interface fc 3/1'
'no shutdown'
'end'
'show interface fc 3/1'
fc3/1 is trunking
Hardware is Fibre Channel, SFP is short wave laser w/o OFC (SN)
Port WWN is 20:81:00:0d:ec:6b:cd:c0
Peer port WWN is 20:01:00:0d:ec:0d:d0:00
Admin port mode is auto, trunk mode is on
snmp link state traps are enabled
Port mode is TE
Port vsan is 1
Speed is 2 Gbps