How to Add an Empty Line to a Text File from a Linux Shell Script

Category: Linux How-To
Posted: October 5, 2019
Author: Antonio

For nicer formatting, you may want to print an empty line from a script into a text file.

You can make an empty line in Linux with this command:

echo -en '\n'

Add >> file.txt to append it to a file:

echo -en '\n' >> file.txt

A plain echo "" >> file.txt does the same, because echo adds a newline by itself.

Related posts:

Leave a Comment

Copying content from this site is allowed only with a direct link to the source - https://nemcd.com