今天终于明白了“2>&1”的意思,真相见内。

$ ./myscript > results.log 2>&1

解释:

Using the (Bourne shell) I/O redirection syntax 2>&1 informs the shell that we wish
to have standard error (file descriptor 2) redirected to the same place to which
standard output (file descriptor 1) is being sent. Thus, the following command
would (since the shell evaluates I/O directions from left to right) send both standard
output and standard error to the file results.log:

你可能感兴趣的:(今天终于明白了“2>&1”的意思,真相见内。)