Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

linux

echo

I am reading the Kafka documentation. In step 6 of 1.3, there's the following code:

> 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.

like image 393
CaTx Avatar asked Nov 25 '25 03:11

CaTx


1 Answers

  • the former recreate the file on each invocation
  • the later append to file. Create the file the first time if not exists

Check

man bash | less +/'Redirecting Output'
like image 120
Gilles Quenot Avatar answered Nov 27 '25 19:11

Gilles Quenot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!