Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 66
    @dbr I don't think it's just bash - I believe it's a bourne shell thing; hence sh, bash, ksh, ash, dash, etc. Commented May 3, 2009 at 23:49
  • 9
    This is part of the redirection paragraph describing POSIX-compliant shells, or POSIX shell for short. ksh is a POSIX shell for example. See:pubs.opengroup.org/onlinepubs/009695399/utilities/… Commented Apr 4, 2013 at 2:55
  • 19
    This construct also works on Windows. Commented Oct 22, 2013 at 13:45
  • 7
    It's generally better doing 2>&1 than 2>/dev/null ;-) Commented Dec 8, 2013 at 12:11
  • 18
    I thought I'd mention that |& is shorthand for 2>&1 | if you're using zsh. I can't speak to whether that applies to other bourne-like shells or if it's a zsh only feature. Commented Dec 17, 2013 at 5:20