you are viewing a single comment's thread
view the rest of the comments
[–] 6 points 2 years ago (1 child)

Yes, but 2>&1 > /dev/null is the real hero.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 2 years ago (1 child)

    No, > /dev/null 2>&1 is. If try your example but with file instead null, stderr content not in file.

    Because x>y not redirect x to y, but duplicate y and set x to y-duplicate. See bash manpage REDIRECTION (your example in that section for what not work).

    As i understand, your example set 2 to what 1 is, then set 1 to null. Now 2 not null, but what 1 before.

  • source
  • parent
  • hideshow 2 child comments