Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^4: capturing command output

by chrestomanci (Priest)
on Jan 25, 2012 at 16:35 UTC ( #949929=note: print w/replies, xml ) Need Help??

in reply to Re^3: capturing command output
in thread capturing command output

Or are you suggesting the OP would run a different command in backticks than in his open? Why would he do that?

No I am saying that plain backticks, without the 2>&1 shell redirection only captures stdout. If you add the shell redirection then of course you get stderr as well, because you asked the shell to do that for you. (Though as Eliya has demonstrated, it is actually perl intercepting the redirection shell trick and doing it within perl.)

Replies are listed 'Best First'.
Re^5: capturing command output
by JavaFan (Canon) on Jan 25, 2012 at 16:51 UTC
    Hmmm, so, you're saying, it's wrong to use backticks, because if you only put half the command in the backticks, it doesn't work?

    I think that's one of the more stupid arguments one can make. If the OP would remove the 2>&1 from his original solution, it would break in the same way.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2016-10-22 20:15 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (297 votes). Check out past polls.