Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: process redirection

by bofh_of_oz (Hermit)
on Jul 25, 2005 at 13:17 UTC ( #477803=note: print w/ replies, xml ) Need Help??


in reply to process redirection

system function only returns the exit status of the command; if you want to capture the output, you should use backticks:

$result = `command`;
Then, you can write this output to wherever you want it with something like this:

open OUTFILE, "> /path/to/outfile.txt"; print OUTFILE $result; close OUTFILE;
 

Alternately, if you do not want to process the output in Perl, you can just do something like this:

system("command > /path/to/result.txt");
However, in this case you probably wouldn't need to use Perl for it at all...

HTH

--------------------------------
An idea is not responsible for the people who believe in it...


Comment on Re: process redirection
Select or Download Code
Re^2: process redirection
by reasonablekeith (Deacon) on Jul 25, 2005 at 13:33 UTC
    but it's his executable that is generating the cab/exe file, it's not being returned on STDOUT. If this was the problem, he'd be complaining that he wasn't generating cab's/exe's at all, not just that they were in the wrong place.

    He needs to change directory as per pbeckingham suggests and SimonClinch demonstrates. (or pass an output file parameter to his exe, if it has one)

    ---
    my name's not Keith, and I'm not reasonable.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://477803]
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: (5)
As of 2014-09-02 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (21 votes), past polls