多次遇到管道问题

having trouble with piping multiple times

因此,该程序将一些内容写入文件,将一些内容写入终端

./program input.txt > output.txt

除了转储到 output.txt 的内容之外,它还会向屏幕打印一些内容。我试图指示它在终端中打印的内容,但我失败了:

./program input.txt > output.txt &>>log

但日志最终为空。

bash 不允许您重定向 stdout 两次。相反,分别重定向 stdout 和 stderr:

./program input.txt > output.txt 2> log