如何追加输出到文本文件中的shell脚本/ bash的结束了吗? [英] How to append output to the end of text file in shell script / bash?
本文介绍了如何追加输出到文本文件中的shell脚本/ bash的结束了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将命令输出追加到一个文本文件的末尾。
How do I append the output of a command to the end of a text file.
推荐答案
使用>>
而不是>
输出保存到一个文件时:
Use >>
instead of >
when directing output to a file:
your_command >> file_to_append_to
如果 file_to_append_to
不存在,它将被创建。
If file_to_append_to
does not exist, it will be created.
示例:
$ echo "hello" > file
$ echo "world" >> file
$ cat file
hello
world
这篇关于如何追加输出到文本文件中的shell脚本/ bash的结束了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文