Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Answer: How to run a shell script from a Perl program?

( #881245=categorized answer: print w/ replies, xml ) Need Help??

Q&A > programs and processes > How to run a shell script from a Perl program? contributed by DeadPoet

If you want the PID, STDOUT, and STDERR, use IPC::Open3.

Example:

use IPC::Open3; local (*IN, *OUT, *ERR); my $pid = eval{ open3( \*IN, \*OUT, \*ERR, 'my_command', 'my_command_args' ); }; if ($@) { warn ($@); } ## capture your output, if needed... ## wait on the pid... wait( $pid, 0 );

Comment on Answer: How to run a shell script from a Perl program?
Download Code
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2015-07-03 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (53 votes), past polls