Which of the following statements is correct regarding the command foo 1> bar?

A. The stdout from the command foo is appended to the file bar.
B. The stdout from the command foo overwrites the file bar.
C. The command foo receives its stdin from the file bar.
D. The command foo receives its stdin from the stdout of the command bar.
E. The stderr from the command foo is saved to the file bar.

题解

「1> bar」会将标准输出串流的消息导给「bar」文件。会覆盖原本的「bar」文件。因此选项 B 是正确答案。

若要将新的消息接在「bar」文件原本的内容之后,应使用「1>> bar」,如此一来答案就会是选项 A 了。