I will preemptively apologize for my lack info regarding the stratus set up we have.
I am using Net::SSH::Perl to connect to a stratus host, run a command, and I am trying to capture the result. The problem is, I am only capturing the first line of the result.
Here is the jist of the perl code I have:
my $ssh = Net::SSH::Perl->new($host,protocol=>2, interactive=>1);
$ssh->login($user, $pass, 1);
my $cmd = 'some_command ' . $cmd_opt;
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print "OUT:$stdout\n ERR:$stderr\n EXIT:$exit\n";
This returns:
OUT: First Line
ERR:
EXIT:0
But, when I ssh to the stratus module and run the command manually, I get:
bash$ cmd opt
First Line
Second Line
bash$
I really need what is returned what is on the second line. (or subsequent lines)
Some history: I am using Net::SSH::Perl because using auth keys is not an option. I dont know why, but that was what I was told, so I have to have a solution that passes the username and pw.
Thanks,
B
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.