Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
The stupid question is the question not asked
 
PerlMonks  

Re^2: capturing command output

by Eliya (Vicar)
on Jan 25, 2012 at 10:51 UTC ( #949873=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ strace -fqeexecve perl -e 'open FH, "echo foo bar 2>&1 |"; print <FH
    +>'
    execve("/usr/bin/perl", ["perl", "-e", "open FH, \"echo foo bar 2>&1 |
    +\"; "...], [/* 77 vars */]) = 0
    [pid  1819] execve("/bin/echo", ["echo", "foo", "bar"], [/* 77 vars */
    +]) = 0
    foo bar
    
  2. or download this
    $ strace -fqeexecve perl -e 'open FH, "echo foo bar ; 2>&1 |"; print <
    +FH>'
    execve("/usr/bin/perl", ["perl", "-e", "open FH, \"echo foo bar ; 2>&1
    + |\""...], [/* 77 vars */]) = 0
    [pid  1833] execve("/bin/sh", ["sh", "-c", "echo foo bar ; 2>&1"], [/*
    + 77 vars */]) = 0
    foo bar
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://949873]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-04-20 20:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (487 votes), past polls