Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 imbibing at the Monastery: (4)
As of 2015-07-29 04:19 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 (260 votes), past polls