- 论坛徽章:
- 0
|
如何将stderr输出的内容同时送往stdout和文件
搞定了,thank you
[quote]原帖由 "bjgirl"]cat file 2>&1|tee file.log[/quote 发表:
bash info里面说重定向的顺序问题:
Note that the order of redirections is significant. For example,
the command
ls > DIRLIST 2>&1
directs both standard output (file descriptor 1) and standard error
(file descriptor 2) 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.
ls 2>&1 > DIRLIST的解释还比较明白
对ls > DIRLIST 2>&1就有点不理解了,感觉两个都是一样的. |
|