How do I append to a file?

0148

To append text to a file in Bash, you can use the >> operator. Here's the syntax:

echo "Your text here" >> filename.txt

Example:

If you want to append "Learning Bash" to a file named notes.txt, you would use:

echo "Learning Bash" >> notes.txt

This command adds "Learning Bash" to the end of notes.txt without deleting its existing content.

If you have any further questions or need more examples, feel free to ask!

0 Comments

no data
Be the first to share your comment!