need_help21 has asked for the wisdom of the Perl Monks concerning the following question:
The value returned by @exit_status = $telnet->cmd("echo $?") is always 0. I don't know why? please someone help !! where i am wrong here??my $telnet = new Net::Telnet ( Timeout=>86400, Errmode=>'die'); $telnet->open('xx.xx.xx.xx'); $telnet->waitfor('/login: $/i'); $telnet->print('xxx'); $telnet->waitfor('/password: $/i'); $telnet->print('xxx'); my $output = $telnet->waitfor('/\$ $/i'); $telnet->print("cd /testdata/BatchValidation/driver"); $output = $telnet->waitfor('/\$ $/i'); $telnet->print("sh $sDriver") or die "cannot execute the sh +ell file"; $telnet->waitfor('/\$ $/i'); my @exit_status = (); @exit_status = $telnet->cmd("echo $?") or warn "ugh\n";; print @exit_status; my $result = $exit_status[0]; print $result; if ($result != '0') { fnShowFormForExecution(); } elsif ($result == '0') { fnShowFormForGettingReport(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: return value of net:telnet is wrong @exit_status = $telnet->cmd("echo $?")
by moritz (Cardinal) on Nov 29, 2007 at 13:40 UTC | |
by need_help21 (Novice) on Nov 29, 2007 at 14:12 UTC | |
by need_help21 (Novice) on Nov 30, 2007 at 05:03 UTC |