如何获取Shell脚本的输出并将其放在命令行的文件中?


4

如何获取Shell脚本的输出并将其放在命令行的文件中?

Answers:


12
# write to file
sh myscript > out.txt
# append to file
sh myscript >> out.txt
# write both output and stderr to file
sh myscript 2&1>> out.txt

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.