Bash scripting question
I am working on a script to help me generate configs for all of the various markets I am responsible for. In each market we have routers, switchs, servers and various other equipment. Rather than creating all of these by hand (over 30 markets with roughly 15 devices per market) I am writing a script. All have common IP's except for the network id. I two made a templates
Which has the IP's of the device. Code:
ip-template Code:
desktop.template Code:
#!/bin/bash In the "desktop.template" you see the #IP# portion. Every other field gets filled in correctly. The problem is I have to refernce a different variable $IPLIST. Is there a way to create another for loop then will assign the right IP's to the right devices? i attempted to nest another for loop inside the original but that did not work. Am I making this harder than it needs to be? Is there an easier way to go about this? |
If you embed the templates into your script as "hereis" documents you can use the variables instead of the #blah# placeholders. Then just echo the hereis document into the wanted file.
|
All times are GMT -5. The time now is 08:05 PM. |