user558134
user558134

Reputation: 1129

Shell append string to file empty line problem

I am using this shell script to append text in a new line at the end of file, but it automatically adds a blank line at the end of the file. How to get rid of it?

echo -e "\n$STRING" >> "filename.txt"

Thanks

Upvotes: 3

Views: 4215

Answers (1)

drysdam
drysdam

Reputation: 8637

echo -ne "\n$STRING" >> "filename.txt"

The -n means "don't add a newline".

Upvotes: 6

Related Questions