|
From: <ngi...@ne...> - 2002-04-17 09:49:28
|
I have a stupid question:
I want to do the following but in perl using the expect perl module.
----------- Start expect code
spawn ssh -l $user $argv
expect "${user}@${argv}'s password:"
send "$password\r"
interact -o -nobuffer -re $prompt return
send "command1\r"
interact -o -nobuffer -re $prompt return
send "command2\r"
interact -o -nobuffer -re $prompt return
send "command3\r"
interact -o -nobuffer -re $prompt return
----------- End expect code
The following code is close but how do I continue after logging in with username/password and execute a
series of command?
If I put qr/$prompt/
$exp->expect($timeout,, sub...
commands
It goes into an endless loop.
----------- Start perl code
[ qr/username: /i, sub { my $self = shift;
$self->send("$username\n");
exp_continue; }],
[ qr/password: /i, sub { my $self = shift;
$self->send("$password\n");
exp_continue; }],
$shell_prompt);
----------- Start perl code
Thanks!
__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/
Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
|