ddrew78 has asked for the wisdom of the Perl Monks concerning the following question:
Here is what I get from that code, I noted the inputs and the error:print HDLCGET "\#\!\/usr\/local\/bin\/expect\n"; print HDLCGET "set timeout -1\n"; open(MYINPUTFILE, "hdlc2"); open(MYINPUTFILE1, "hdlc3"); while(<MYINPUTFILE>) { my($line) = $_; chomp($line); while(<MYINPUTFILE1>) { my($line1) = $_; chomp($line1); print HDLCGET "spawn \ ssh $line\n"; print HDLCGET "expect \"assword: \"\n"; print HDLCGET "send \"$tacacspw\\r\"\n"; print HDLCGET "expect \"#\"\n"; print HDLCGET "send \"terminal length 0\\r\"\n"; print HDLCGET "expect \"#\"\n"; print HDLCGET "send \"show xconnect all | inc $line1\\r\"\nexp +ect \"#\"\n"; print HDLCGET "send \"exit\\r\"\n"; print HDLCGET "interact\n"; } } close(MYINPUTFILE); close(MYINPUTFILE1);
Also, while I'm using 2 input files here, later on I will have to use 4 input files, but I haven't gotten to that part yet, and I figured the same logic should apply#!/usr/local/bin/expect set timeout -1 spawn ssh 10.247.17.141 <-- line 1 of hdlc2 expect "assword: " send "tacacspw\r" expect "#" send "terminal length 0\r" expect "#" send "show xconnect all | inc 99999999\r" <--line 1 of hdlc3 expect "#" send "exit\r" interact spawn ssh 10.247.17.141 <--LINE 1 OF hdlc2, SHOULD BE LINE 2 expect "assword: " send "Kalewi13\r" expect "#" send "terminal length 0\r" expect "#" send "show xconnect all | inc 616698950\r" <--line 2 of hdlc3 expect "#" send "exit\r" interact
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using multiple input files #2
by Corion (Patriarch) on Mar 31, 2009 at 16:54 UTC | |
|
Re: Using multiple input files #2
by kennethk (Abbot) on Mar 31, 2009 at 16:54 UTC | |
by ddrew78 (Beadle) on Mar 31, 2009 at 17:22 UTC | |
by kennethk (Abbot) on Mar 31, 2009 at 17:46 UTC | |
by ddrew78 (Beadle) on Mar 31, 2009 at 17:54 UTC |