参见: /usr/include/unistd.h

/* Standard file descriptors.  */
#define STDIN_FILENO    0   /* Standard input.  */
#define STDOUT_FILENO   1   /* Standard output.  */
#define STDERR_FILENO   2   /* Standard error output.  */

0 输入

1  STDOUT

2  STDERR

bash#cmd 2>&1  重定向 STDERR

 

http://stackoverflow.com/questions/818255/in-the-shell-what-is-21