paranoid times has asked for the wisdom of the Perl Monks concerning the following question:
$timeout = 1; $command = '/usr/bin/ssh'; @paramaters = ('servername','pwd'); $exp = Expect->spawn($command, @paramaters) or die "Cannot spawn $command: $!\n"; $exp->expect($timeout, [ qr/password/ ]); $exp->send("password\n"); $exp->soft_close();
$output = $exp->exp_after(); # and $output = $exp->expect($timeout, [ qr/password/ ]); # and $output = $exp->send("password\n");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Collecting output from Expect
by rminner (Chaplain) on Oct 17, 2007 at 09:10 UTC | |
by paranoid times (Acolyte) on Oct 18, 2007 at 04:26 UTC | |
|
Re: Collecting output from Expect
by shmem (Chancellor) on Oct 17, 2007 at 09:38 UTC | |
by paranoid times (Acolyte) on Oct 18, 2007 at 04:30 UTC |