Glam Prestige Journal

Bright entertainment trends with youth appeal.

When using echo "foo">> bar.txt more than once it appends to the end of a file. How to overwrite bar.txt each time?

1

1 Answer

> is for redirecting to a file (overwriting it), while >> is for appending.

To overwrite bar.txt, use this:

echo "foo" > bar.txt
5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy