You can run tcl commands from either a script or on the command line using the tclsh command.
Note
|
You cannot create a tcl script file at the CLI prompt. You can create the script file on a remote device and copy it to the
bootflash: directory on the Cisco NX-OS device.
|
This example shows an interactive tcl shell:
switch# tclsh
switch-tcl# set x 1
switch-tcl# cli show module $x | incl Mod
Mod Ports Module-Type Model Status
1 32 1/10 Gbps Ethernet Module N7K-F132XP-15 ok
Mod Sw Hw
Mod MAC-Address(es) Serial-Num
Mod Online Diag Status
Left ejector CLOSE, Right ejector CLOSE, Module HW does support ejector based shutdown.
switch-tcl# exit
switch#
This example shows how to run a tcl script:
switch# show file bootflash:showmodule.tcl
set x 1
while {$x < 19} {
cli show module $x | incl Mod
set x [expr {$x + 1}]
}
switch# tclsh bootflash:showmodule.tcl
Mod Ports Module-Type Model Status
1 32 1/10 Gbps Ethernet Module N7K-F132XP-15 ok
Mod Sw Hw
Mod MAC-Address(es) Serial-Num
Mod Online Diag Status
Left ejector CLOSE, Right ejector CLOSE, Module HW does support ejector based shutdown.
switch#