![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problems installing expect utilty | vikas027 | Shell Programming and Scripting | 5 | 07-06-2009 03:56 PM |
| input from a file into an expect script ? | starsky | Shell Programming and Scripting | 2 | 04-16-2008 12:38 PM |
| File as input for a script | innocentspirit | Shell Programming and Scripting | 5 | 10-26-2007 01:03 AM |
| suppress echo while reading input in expect | sudhir_onweb | Shell Programming and Scripting | 1 | 07-23-2007 10:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Expect script with file input problems
Hello,
I am trying to write an expect script that will ssh into a large number of Cisco routers and add some commands via the cli. The script I wrote works great for one host however I have over 350 routers that this needs to be added to. The problem is I cannot get the script to read the file of hosts. Below is the shell script and the expect script. The host file is called host_list. Any suggestions would be very much appreciated as I am about to pull my hair out. Thanks. [~]$ cat pan_hosts #!/usr/local/bin/bash cat ./host_list | while read hosts; do ./pan $LINE done -------- [~]$ cat pan #!/usr/local/bin/expect set host [lindex $argv 0] spawn ssh -l root $host set timeout 7 expect "assword: $" send "xxxxxxxxx\n" expect "#" send "config t\n" expect "onfig)#" send "ntp server 10.10.1.89 prefer\n" expect "onfig)#" send "ntp source vlan 1\n" expect "onfig)#" send "clock timezone CST -6\n" expect "onfig)#" send "clock summer-time CDT recurring\n" expect "onfig)#" send "access-list 88 permit 65.242.29.0 0.0.0.255\n" expect "onfig)#" send "access-list 88 permit 24.182.133.64 0.0.0.7\n" expect "onfig)#" send "snmp-server community xxxxxxxxxxxxxxxxxx rw 88\n" expect "onfig)#" send "exit\n" expect "#" send "wr\n" expect "#" send "exit\n" |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|