jcpunk has asked for the wisdom of the Perl Monks concerning the following question:
this outputs#!/usr/bin/perl -w use strict; use Net::Telnet; my $username = "user"; my $password = "password"; my $host = "localhost"; my $telnet = new Net::Telnet ('Timeout'=>'7', 'Prompt'=> '/.*([\$#\%>~]|\\\[\\e\[0m\\\ +] \[0m)\s?/' ); ; my $shiznat = "default value"; $telnet->open(Host=>$host); $telnet->login($username,$password); $telnet->dump_log("loging.log.log"); $telnet->cmd('String' => "/bin/echo \\\$stuff", 'Output' => \$shiznat); print $shiznat; $shiznat=$telnet->getline; print $shiznat; $telnet->cmd('String' => "/bin/echo \$stuff", 'Output' => \$shiznat); print $shiznat; $shiznat=$telnet->getline; print $shiznat;
anyone have any thoughts? (please note that getline will not solve the programs problem(just my curiousity) i am actually developing as i have to deal with a 6 line file (unless you can make it read all 6 (possibly 18) lines)) it appears (to me in my ignorance) that this should work correctly (well the 1st cmd the second is just to prove a point about $'s and how the escaping does not change the output) and if you check the log file you will discover that $stuff was echoed but only stuff returned to you for usestuff stuff
by the way thanks for all the help that was, is, and will be
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::Telnet, $, and crushed expectations
by castaway (Parson) on Jul 01, 2003 at 10:49 UTC | |
by jcpunk (Friar) on Jul 01, 2003 at 14:13 UTC | |
|
Re: Net::Telnet, $, and crushed expectations
by Mr. Muskrat (Canon) on Jul 01, 2003 at 13:53 UTC | |
by jcpunk (Friar) on Jul 01, 2003 at 14:20 UTC |