现在的位置: 首页 > 综合 > 正文

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

2016年12月09日 ⁄ 综合 ⁄ 共 350字 ⁄ 字号 评论关闭

$ ./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:

抱歉!评论已关闭.