Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

net::telnet

Status
Not open for further replies.

malpa

Technical User
Feb 8, 2004
122
0
0
CO
Hi

there are 3 possibilities of reponse when i run a command using
$host->print($comando);

$host->waitfor(

1- '/CONFIRM COMMAND EXECUTION: Y\/N \? /i'
or 2- '/DO YOU WANT TO WAIT FOR RECOVERY OR EXECUTE PARALLEL WITH CURRENT JOBS/i'
or 3- '/< /i'

)

for 1 and 2 I must to print $host->print("Y");
for 3 I must to wait for '/< /i' and continue with the next line.

This is my programm

while ( $linea ne "" ){
chomp($linea);
if ( $linea =~ /^Z/ ) {
$comando=$linea;
print $comando."\n";
$host->print($comando);
if ( $host->waitfor('/CONFIRM COMMAND EXECUTION: Y\/N \? |DO YOU WANT TO WAIT FOR RECOVERY OR EXECUTE PARALLEL WITH CURRENT JOBS/i') ) {
$host->print("Y");}
else { $host->waitfor('/< /i') }
}

$linea=<FILE_ACC>;
}


any suggestion

Thanks
Malpa
 
Hi

Im sorry

That I want is to choose an option depending of the message registered by the $host->waitfor();


$match=$host->waitfor('/CONFIRM COMMAND EXECUTION: Y\/N \? /i' or '/DO YOU WANT TO WAIT FOR RECOVERY OR EXECUTE PARALLEL WITH CURRENT JOBS/i'or '/< /i )'
)

if ($match =="CONFIRM COMMAND EXECUTION: Y\/N \? " )
host->print("Y")
elseif ( $match =="DO YOU WANT TO WAIT FOR RECOVERY OR EXECUTE PARALLEL WITH CURRENT JOBS")
$host->print("Y")
elseif ($match =="< ")
$host->print(" \000 ") -> next line of file

else {}

But this program does not function
any suggestion

Thanks
malpa
 
Annihilannic

Thanks, i appriciate your comments.

Your question
only $host->print("Y"); why? because I m going to erase old infomation and after that i will create again.

I was testing and i found a way to do this, but I don`t know if is it the best way.

$comando1="Y";
$host->print($comando);
($prematch,$match)=$host->waitfor(
-match=>'/CONFIRM COMMAND EXECUTION: Y\/N \? /i',
-match=>'/DO YOU WANT TO WAIT FOR RECOVERY OR EXECUTE PARALLEL WITH CURRENT JOBS/i',
-match=>'/< /i',
-timeout=>2,
);
if($match=~/CONFIRM COMMAND EXECUTION: Y\/N \? |DO YOU WANT TO WAIT FOR RECOVERY OR EXECUTE PARALLEL
WITH CURRENT JOBS/){
print FILE_COM $prematch;
print FILE_COM $match;
print FILE_COM $comando1."\n";
$host->print($comando1);
($prematch1,$match1)=$host->waitfor('/< /i');
print FILE_COM $match1;
}
elsif ( $match=~/< / ) {

print FILE_COM $prematch;
print FILE_COM $match;

}
else{}

Thanks
Malpa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top