Hi,
I have used this example program to telnet to a
different box (from a RH Linux 6.2 box to a FreeBSD
box), but I cannot get the right output. It appears
to just echo the command and the path. Any ideas what
I am doing wrong. I thought it was supposed to print
out the list of who is on the machine. I know there
are at least 10 people on this machine. Any help
would be appreciated.
###########################################################################
Screen output:
###########################################################################
[djh@duke:~/telnet]$ ./run.pl
/usr/bin/who
/chicago/sqa/sqa
sqa@sparky[djh@duke:~/telnet]$
###########################################################################
###########################################################################
Code
###########################################################################
#!/usr/local/bin/perl -w
use Net::Telnet ();
$username = "sqa";
$passwd = "sqa";
$machine = "sparky";
my $command = "/usr/bin/who";
$t = new Net::Telnet (Timeout => 15, Prompt =>
'/\#/');
$t->open($machine);
$t->login($username, $passwd);
my @array = $t->cmd($command);
print @array;
$t->close;
###########################################################################
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]