Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: How to run bash file from perl

by SimonClinch (Chaplain)
on May 19, 2011 at 09:13 UTC ( #905642=note: print w/ replies, xml ) Need Help??


in reply to Re: How to run bash file from perl
in thread How to run bash file from perl

If it hangs, it probably needs input, in which case IPC::Open2 or IPC::Open3 and print to the input channel of the subprocess, close it and read the output. But you still need to know what it expects and what to expect back. Try running the command directly and saving sample I/O to files, e.g. stdin.dat stdout.dat and stderr.dat. Then use these files as a template for designing your program around open2 or open3.

hint; to save input to a file, use:

echo ' stuff ' | tee stdin.dat | command.sh args >stdout.dat 2>stderr.dat

One world, one people


Comment on Re^2: How to run bash file from perl
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://905642]
help
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: (6)
As of 2014-08-30 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls