To execute the commands specified in a file, use the
run-script command.
run-script [bootflash: | slot0: | volatile: ] filename
Syntax Description
bootflash:
|
(Optional) Source or destination location for internal
bootflash memory.
|
slot0:
|
(Optional) Source or destination location for the
CompactFlash memory or PCMCIA card.
|
volatile:
|
(Optional) Source or destination location for volatile file
system.
|
filename
|
Name of the file containing the commands.
|
Command Default
Uses the current default directory.
Command History
Release
|
Modification
|
1.0(2)
|
This command was introduced.
|
3.0(1)
|
Updated the Usage Guidelines and Examples with information
about user-defined variables.
|
Usage Guidelines
To use this command, be sure to create the file and specify commands
in the required order.
The
run-script command accepts user-defined variables
as parameters.
Examples
The following example executes the CLI commands specified in the
testfile that resides in the slot0 directory:
switch# show file slot0:testfile
conf t
interface fc 1/1
no shutdown
end
sh interface fc1/1
In response to the
run-script command, this is the file output:
switch# run-script slot0:testfile
'conf t'
Enter configuration commands, one per line. End with CNTL/Z.
'interface fc 1/1'
'no shutdown'
'end'
'sh interface fc1/1'
fc1/1 is down (Fcot not present)
Hardware is Fibre Channel
Port WWN is 20:01:00:05:30:00:48:9e
Admin port mode is auto, trunk mode is on
vsan is 1
Beacon is turned off
Counter Values (current):
0 frames input, 0 bytes, 0 discards
0 runts, 0 jabber, 0 too long, 0 too short
0 input errors, 0 CRC, 0 invalid transmission words
0 address id, 0 delimiter
0 EOF abort, 0 fragmented, 0 unknown class
0 frames output, 0 bytes, 0 discards
Received 0 OLS, 0 LRR, 0 NOS, 0 loop inits
Transmitted 0 OLS, 0 LRR, 0 NOS, 0 loop inits
Counter Values (5 minute averages):
0 frames input, 0 bytes, 0 discards
0 runts, 0 jabber, 0 too long, 0 too short
0 input errors, 0 CRC, 0 invalid transmission words
0 address id, 0 delimiter
0 EOF abort, 0 fragmented, 0 unknown class
0 frames output, 0 bytes, 0 discards
Received 0 OLS, 0 LRR, 0 NOS, 0 loop inits
Transmitted 0 OLS, 0 LRR, 0 NOS, 0 loop inits
The following example shows how you can pass user-defined variables
to the
run-script command:
switch# run-script bootflash:test2.vsh var1="fc1/1" var2="brief"
switch # show interface $(var1) $(var2)
-------------------------------------------------------------------------------
Interface Vsan Admin Admin Status SFP Oper Oper Port
Mode Trunk Mode Speed Channel
Mode (Gbps)
-------------------------------------------------------------------------------
fc1/1 1 auto on sfpAbsent -- -- --