From: Mathias D. <mde...@ho...> - 2002-05-06 12:07:11
|
Hello, I am using Expect 1.15 on the Perl for Cygwin release 5.6.1-2. I want to use Expect with SSH2 to automate some commands that I have to do regularly on remote servers. But so far I have not been able to do this properly. I am using F-Secure SSH for Windows, maybe this causes some trouble? With F-Secure SSH2, I am not able to give any parameter to the process, and with a sftp2 from SSH, the password is entered succesfully by the script after catching the password prompt, but then I can't do anything else, as Expect doesn't seem to catch the prompt given by sftp2. Some other tests seem to show that I have the same problem when using ftp. The prompt is shown on the screen, but Expect won't catch it. Is this a known issue?? I'm getting quite desperate. Here is my very simple sample script: ---------------------------------------------------------- #! /usr/bin/perl -w use Expect $Expect::Log_Stdout=1; $Expect::Exp_Internal=1; my $cmd="/path/sftp2 -P port user\@IP.IP.IP.IP"; my $process = new Expect; $process->raw_pty(1); $process->spawn($cmd); $process->expect(10, "word: "); $process->send("mypassword\n"); $process->expect(10, "sftp>"); # here, sftp> appears on the screen, but isn't read by Expect $process->send("ls\n"); # consequently, ls\n is written after the timeout occurs, but there is no reaction from sftp. Moreover, if I type the ls command by hand on the keyboard, it'll work $process->expect("sftp>"); _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |