shell 中 '>' 与‘>>’ 的区别

在shell中

'>'  为创建: echo “hello shell”  > out.txt

'>>' 为追加:echo “hello shell”  >> out.txt

当out.txt 文本不存在时,'>'与‘>>’都会默认创建out.txt文本,并将hello shell 字符串保存到out.txt中

当out.txt文本存在时,‘>’会将out.txt文本中的内容清空,并将hello shell 字符串存入

                                   而‘>>’会将 hello shell追加保存到out.txt的末尾

猜你喜欢

转载自blog.csdn.net/nahanai/article/details/83861449
今日推荐