Command Scripts
S e n d f e e d b a c k t o n x 5 0 0 0 - d o c f e e d b a c k @ c i s c o . c o m
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
Using CLI Variables in Scripts
You can use CLI variables defined by the cli var command (see the
page
The following example shows how to use CLI session variables in a script file used by the run-script
command:
switch# cli var name testinterface fc 1/1
switch# show file bootflash:test1.vsh
show interface $(testvar)
switch# run-script bootflash:test1.vsh
`show interface $(testvar)`
Cisco Nexus 5000 Series Switch CLI Software Configuration Guide
2-12
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
Transmit B2B Credit is 255
Receive B2B Credit is 16
Receive data field Size is 2112
Beacon is turned off
Trunk vsans (admin allowed and active) (1)
Trunk vsans (up)
Trunk vsans (isolated)
Trunk vsans (initializing)
5 minutes input rate 96 bits/sec, 12 bytes/sec, 0 frames/sec
5 minutes output rate 64 bits/sec, 8 bytes/sec, 0 frames/sec
77423 frames input, 6708868 bytes
0 discards, 0 errors
0 CRC,
0 unknown class
0 too long, 0 too short
77302 frames output, 4184976 bytes
0 discards, 0 errors
1 input OLS, 2 LRR, 0 NOS, 0 loop inits
1 output OLS, 0 LRR, 1 NOS, 0 loop inits
16 receive B2B credit remaining
255 transmit B2B credit remaining
2-9) or passed as arguments in the run-script command.
Chapter 2
Using the Command-Line Interface
(1)
()
()
"Using CLI Variables" section on
OL-16597-01