Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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?
[Your Mother]: I like Manu Chao.
[Your Mother]: I like this one quite well, https://www. youtube.com/watch? v=rSEUH4KRfN8
[choroba]: Půlnoční Marie (which means Midnight Mary)
[choroba]: but the band is practically dead. We rehearse once in a year, and perform with the same frequency
[ambrus]: `quote
[ambrus]: sorry, typed in the wrong box
[LanX]: Your mother: je ne t'aime plus! ;)
[choroba]: seems lispy
[Your Mother]: Be nice! I speak that much French. Though I also like that song.
[choroba]: So, I joined Pod Černý Vrch some months ago to still have the fun. But I wouldn't call it "punk" anymore...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2017-03-24 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.