Run several commands at once

From Internetworkpro

Jump to: navigation, search
This page or section provides device configuration instructions
Please note that the information on this page has not been checked for accuracy and is not intended as a replacement to documentation. Please ensure you understand your desired objectives before attempting to apply any examples listed.
See more examples at Category:Configuration

You might ask yourself: "Why?" Imagine you want to alter the configuration but you know that if you will do so using the prompt you will lose connectivity. For example: changing an ACL.

You can do so using tclsh

First run tclsh:

Router#tclsh

Put the commands you want to run between the bracket signs {}:

Router(tcl)#set x {
+>conf t
+>int f0/0
+>ip addr 1.1.1.1 255.255.255.0
+>exit
+>exit
+>}

conf t
int f0/0
ip addr 1.1.1.1 255.255.255.0
exit
exit

Now execute the commands:

Router(tcl)#eval $x

Quit tclsh


Router(tcl)#tclq


Enjoy...

Personal tools