Hello, I would like to run a perl script that sits on my win machine (client) on a unix server. I have putty/plink etc. setup where from a win command prompt I can execute any command on the unix server (using rsa keys for ssh authentication). I have the following in my perl script:
system("plink $server"); rest of my perl script
However, it does log in fine but does not execute the rest of the perl script. Also how can I use perl to get the permissions on a file and print the same to a text file. This is my code:
chdir ($pathToCheck); open theInputFile, $inputFile or die "Could not read from $inputFi +le, program halting. \n"; open (theOutputFile, '>', $outputFile) or die "Could not open $out +putFile. \n"; while (<theInputFile>) { chomp; my $fileBeingChecked = "$_"; if (-e $fileBeingChecked) { #my $fileSize = -s $fileBeingChecked; my $fileSize = stat($fileBeingChecked)->size; my $date_string = ctime(stat($fileBeingChecked)->mtime); print theOutputFile "Yes, $fileSize, $date_string \n"; } else { print theOutputFile "No \n"; } } close (theOutputFile); close (theInputFile);
I would like to add the permissions on the file - whether write or read etc. also to the theOutputFile. Any suggestions ?

In reply to run a perl script on a unix machine from a win machine by akrrs7

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.