Bash Nitpicking on Redirections

This little excerpt from the bash man page explains the reason I just wasted 2 hours:

Note that the order of redirections is significant.  For example, the command
ls > dirlist 2>&1
directs both standard output and standard error to the file dirlist, while the command
ls 2>&1 > dirlist
directs only the standard output to file dirlist, because the standard error was duplicated as standard output before the standard output was redirected to dirlist.



This entry was posted on Wednesday, August 12th, 2009 at 15:13 and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Bash Nitpicking on Redirections”

  1. name

    Not bash-specific. That is how the Bourne
    shell has always been.

Leave a Reply

Your comment