Problem with very simple Expect script

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

All -
  I can't get a more complicated expect script to work, so I broke it
down to the basics, and I can't get that to work either. Maybe I have
been looking at it too long. Anyway, no matter what I do, the log file
is empty, I don't think the spawn command is working. I am not getting
any errors. Suggestions?


use Expect;
my($exp) = new Expect; #Set exp for Expect

#Set Expect options
$exp-> raw_pty(1); #eliminates echo back to expect
$exp-> log_file("/expect.log", "w");
$exp-> debug(0);

  # create an Expect object
   $exp-> spawn("ssh -l username")
            or die "Cannot spawn $command: $!\n";
   $exp-> expect(10, "username@'s password: ");
   $exp-> send("password\r");



Site Timeline