当我看到这个问题How can I write and append using echo command to a file
时的后续问题我试图找到它应该已经得到回答,但显然它不存在或者我找不到它。
我真的很想在这个网站上发帖(这是我的第一个!)
答案 0 :(得分:4)
>
是“覆盖”,>>
是“追加”。前者将覆盖文件,后者将添加到最后。
echo foo > file
echo bar > file
cat file
# => bar
echo foo > file
echo bar >> file
cat file
# => foo
# bar