在我继承的脚本中,我们的一个程序的输出被放入一个文件中:
program &>> result.txt
Run Code Online (Sandbox Code Playgroud)
我一直在读我的书“学习的bash shell”在家里过周末,却找不到这意味着什么(我知道>
和>>
平均值)。
我错过了一些明显的东西?
小智 34
您的书可能太旧了,这是 Bash 版本 4 中的新内容。
program &>> result.txt
Run Code Online (Sandbox Code Playgroud)
相当于
program >> result.txt 2>&1
Run Code Online (Sandbox Code Playgroud)
将 stdout 和 stderr 重定向并附加到 file result.txt
。在此处详细了解 I/O 重定向。