简体   繁体   English

使用带有一个大于号和两个大于号的 echo 的区别

[英]Difference between using echo with one greater than sign and two greater than signs

I am reading the Kafka documentation .我正在阅读 Kafka文档 In step 6 of 1.3, there's the following code:在1.3的第6步中,有如下代码:

> echo foo> test.txt
> echo bar>> test.txt

I would like to ask what is the difference between using one greater than sign and two greater than signs.请问用一个大于号和两个大于号有什么区别。 Thanks.谢谢。

  • the former recreate the file on each invocation前者在每次调用时重新创建文件
  • the later append to file.后面的append来归档。 Create the file the first time if not exists如果文件不存在则第一次创建

Check查看

man bash | less +/'Redirecting Output'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM