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
In reply to Net::Telnet, $, and crushed expectations by jcpunk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |