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

4 unix shell-script

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

Am.*_*Am. 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
Run Code Online (Sandbox Code Playgroud)