10-13-2016 06:02 AM - edited 03-08-2019 07:47 AM
I am putting together a small script (series of commands in a Notepad .txt file) to be run from cli on a variety of Cisco Catalyst switches and routers. Because the number of vty lines varies on the different platforms, I would like to be able to specify
line vty 0 15
except instead of just putting the actual number 15, have the command put in the highest number of vty lines possible. How can I do this without creating a different script for each different switch, router, vg, etc?
Thanks,
Mike
10-13-2016 06:46 AM
Mike
If this is a set of commands that you will copy and paste from Notepad then it seems that your only alternative is to pick a number and put it into the command or create a set of the scripts with one for each platform type. If you want to get into an interactive scripting environment then you could specify a variable and check for platform and set the variable appropriately. But that is a much more complex thing to write.
HTH
Rick
10-17-2016 06:50 AM
Most equipment supports up to 5 vty so You can write it like this
line vty 0 4
< your commands>
line vty 5 15
< your commands>
this way, for equipment that doesn't support vty range up to 15, you got it to work with the 0 to 4 and then just an error.
/Mikael
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide