Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello, I am running a Perl script on a Win NT machine that retrieves web log files and data from servers outside of a firewall. I use an NT command line version of ssh and scp (called plink and pscp) from within the Perl script. The Perl script is run socksified under sockscap32. For some reason, I cannot capture (save to a variable) string data that results from a backticked or open/piped ssh call within the Perl script whenever it is run socksified. If it is not socksified, everything works fine. Here is an example of what I want to do:

myscript.pl -------- $data = `plink -ssh -pass mypass someuser@external.machine.com "ls -l +/home/someuser"`; # Do something with $data.... --------

In order to socksify the Perl script, I call
sc32.exe c:\Perl\bin\Perl.exe myscript.pl

from within a batch file. The ugly workaround I have involves writing the output of the ssh command on the remote machine to a file and then scp'ing the file to my local machine. Please help me find something elegant! Thank you,
Mark Hoefer
mark_hoefer@agilent.com

In reply to Capturing data with backticks and sockscap by Anonymous Monk

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2022-08-18 22:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?