tuffgong2008 has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for any help rendered.#!/usr/bin/perl $user="username"; $pass="password"; $server="##.##.##.##"; use Net::Telnet; $t = new Net::Telnet; $t->open("$server"); $t->waitfor('/Enter User Name/'); $t->print("$user"); $t->waitfor('/Enter Password/'); $t->print("$pass"); $t->waitfor('/>/'); $t->print("servord"); open(LIST,"roamers.txt"); @numbers=<LIST>; foreach $number (@numbers) { $t->waitfor('/>/'); $t->print("deo"); $t->waitfor('/>/'); $t->print(""); $t->waitfor('/>/'); $t->print("$number"); $t->waitfor('/>/'); $t->print("cdw"); $t->waitfor('/>/'); $t->print("arw"); $t->waitfor('/>/'); $t->print("\$"); $t->waitfor('/>/'); $t->print("y"); # I need an "error checker" here. If giving the 'Y' command gives an # error output, then the following cmd should be 'N' # before continuing the loop. } close(LIST); $t->waitfor('/>/'); $t->print("quit all;logout");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading a telnet command output
by laceytech (Pilgrim) on Dec 20, 2008 at 10:50 UTC | |
by Anonymous Monk on Dec 20, 2008 at 15:35 UTC |