Click here to get back home

Problem with very simple Expect script

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Problem with very simple Expect script craig.carl 04-24-2005
Posted by craig.carl on April 24, 2005, 8:42 pm
Please log in for more thread options


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?

#!/usr/bin/perl
#!/usr/bin/expect

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 144.48.81.20 -l username")
or die "Cannot spawn $command: $!n";
$exp-> expect(10, "username@144.48.81.20's password: ");
$exp-> send("passwordr");

Thanks,

C



Similar ThreadsPosted
Simple expect problem . March 21, 2007, 2:31 pm
Expect::Simple December 1, 2005, 4:19 pm
Expect::Simple December 2, 2005, 9:22 am
Expect.pm module help - simple question... March 15, 2005, 12:27 pm
Expect - "sleep" executed at the wrong time (before an expect(... send...) instead of after) September 18, 2008, 4:58 am
XML::Simple Problem February 16, 2006, 5:13 pm
Problem with DBD::Oracle in cgi-script August 28, 2007, 3:15 am
DBI does not do what I expect... March 12, 2008, 4:18 am
using Net::SSH::Perl with Expect November 21, 2005, 3:41 pm
Expect: Getting PID at both ends of ssh January 22, 2007, 3:08 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap