Command Looping

Top  Previous  Next

New with version 4.3.2 is the ability to send the same command(s) over and over without having to repeat those same commands over and over in the command input file.  This is accomplished through the use of two keywords in the command file; LOOPSTART <num> and LOOPEND (all capital letters).  All of the commands in between the LOOPSTART and LOOPEND commands will be repeated the number of times specified by the LOOPSTART command.  The scripts that support this feature are

 

cisco_send_cmds

cisco_send_cmds_rcf

cisco_config_cmds

cisco_config_cmds_rcf

pix_send_cmds

catos_send_cmds

generic_send_cmds

nxos_send_cmds

nxos_config_cmds

 

The best way to describe this is with an example.  The example below will issue the show version command, then the show clock command.  Then it will enter the show proc cpu and show memory stat commands 100 times (note there will be a 5 second delay between each iteration of the command being entered because of the SLEEP 5 command).  After the loop ends, the show clock command will be entered once and the script is finished sending commands to that device.

 

show version
show clock
LOOPSTART 100
show proc cpu
show memory stat
SLEEP 5
LOOPEND
show clock

 

 

       Note:  Nested Loops are not supported.