Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-12-21 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (108 votes), past polls