splatohara has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use Expect; my $command = new Expect; #print $command "telnet stiletto23-cssp0\r"; $command = Expect->spawn("telnet stiletto23-cssp0") or die "Couldn't s +tart program: $!\n"; sleep 1; #prevent output from being shown on our STDOUT $command->log_stdout(1); #wait 10 seconds for "username:" to appear unless ($command->expect(10, "username:")) { #print "timed out"; } # send "username" and a carriage return to the program print $command "admin\r"; sleep 1; print $command "netra1\r"; print "now here\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: writing to an object (telnet session) using expect
by BUU (Prior) on Oct 02, 2003 at 17:53 UTC | |
|
Re: writing to an object (telnet session) using expect
by delirium (Chaplain) on Oct 02, 2003 at 19:23 UTC |