First off - I would say I am intermediate PERL programmer. I can follow instruction, examples, etc. I wrote a program to ssh2 into a server and return some data. I've posted code that works vs code that doesn't work. Here's the problem... If i put something like 'ls -la /directory/cirectory2' within the parens on the exec line it works ok. However my zcat command with the grep statement doesn't work :/ The $ibmslapd_fn variable is poulated and is a string format. I've also tried it with & without the dbl quotes and would really like to know what I'm doing wrong so I can get the zcat cmd to work too! Thanks in advance for your time and knowledge.

THIS WORKS FINE
my $chan = $ssh2->channel(); $chan->blocking(0); $chan->exec('ls -la /db2home/idsldap/idsslapd-idsldap/logs/'); while (<$chan>){ print FILE } print FILE "\n\n\n\n"; $ssh2->disconnect(); ### DISCONNECT ###
THIS DOESN'T WORK
my $chan = $ssh2->channel(); $chan->blocking(0); $chan->exec('zcat /db2home/idsldap/idsslapd-idsldap/logs/ibmslapd.log. +$ibmslapd_fn-2350.gz | grep -i "entries have been successfully" '); while (<$chan>){ print FILE } print FILE "\n\n\n\n"; $ssh2->disconnect(); ### DISCONNECT ###



In reply to NET:SSH2 exec syntax usage by ZigZaggin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.