Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Okay I stand corrected in that order matters. That said, I honestly can't remember ever seeing 2>&1 not coming at the end of the command line, probably because doing so seems to indicate that it won't be captured to STDOUT as one desires.

~/stuff > cat JGBtest.txt Just a starting point ~/stuff > perl 2>&1 >>JGBtest.txt Going to STDERR ~/stuff > cat JGBtest.txt Just a starting point Normal STDOUT ~/stuff > perl 2>&1 >>JGBtest.txt | grep STD Going to STDERR ~/stuff > perl 2>&1 | grep STD Going to STDERR Normal STDOUT ~/stuff >

With all of the foregoing comments by both you and me in mind, I think you're first comment implies that it must come first in order to be captured. But in the interest of being complete even if I'm wrong, I included the final tests that does actually demonstrate what is happening on the command line (though it is not intuitive.) Also, it is possible that setting $| = 1; might alter the output ordering.

You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

In reply to Re^6: capturing stderr of echo piped to a file by boftx
in thread capturing stderr of echo piped to a file by cebundy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-06-23 13:47 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.