【发布时间】:2015-02-27 16:36:42
【问题描述】:
我有一个控制台应用程序,我希望它的输出出现在控制台上并存储在一个文件中。我一直在使用 tee 输出到控制台和文件,但我也希望将用户输入写入文件
现在写我一直在用
./a.out | tee -a output.txt
我看到了很多关于如何从文件重定向的建议,也看到了这个链接How to redirect console output to file and STILL get it in the console?
建议使用 2>$1,但这仍然无法让用户输入文件。
【问题讨论】:
-
` nano some_file` :)
-
您需要在程序本身中
echo用户输入才能将其放入文件中。
标签: bash redirect input console