anilhpn has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl Monks, Look at following code:
use strict; use Expect; my $timeout = 10; my $command = 'telnet'; my $params = ("10.123.125.13"); # Create the Expect object my $exp = Expect->spawn($command, $params) or die "Cannot spawn sftp c +ommand \n"; $exp->expect($timeout, ["mpp>"]); $exp->send("enable\n"); $exp->expect($timeout, ["mpp#"]); $exp->send("help\n"); # Help gives list of available commands $exp->expect($timeout, ["mpp#"]); $exp->send("exit\n"); $exp->send("logout\n"); $exp->soft_close();
Here I would like get output after command 'help\n'. I tried with $exp->before and after with no success. Please let me know if anybody knows a good solution (no need end-to-end code atleast any idea should be fine). Thanks! Anil A Kumar
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Expect Command output
by Khen1950fx (Canon) on Aug 27, 2011 at 22:53 UTC | |
by armstd (Friar) on Aug 28, 2011 at 18:00 UTC | |
by anilhpn (Initiate) on Sep 15, 2011 at 18:11 UTC | |
by sugarboy (Beadle) on Mar 02, 2016 at 09:17 UTC |