print HDLCGET "\#\!\/usr\/local\/bin\/expect\n"; print HDLCGET "set timeout -1\n"; open(MYINPUTFILE, "hdlc2"); open(MYINPUTFILE1, "hdlc3"); while() { my($line) = $_; chomp($line); while() { 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\"\nexpect \"#\"\n"; print HDLCGET "send \"exit\\r\"\n"; print HDLCGET "interact\n"; } } close(MYINPUTFILE); close(MYINPUTFILE1); #### #!/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