There is a pitfall (at least for beginners like me) related to linebreaks when working with variables.
Consider a text variable containing a line break in it:
Code:
var="first line
second line"
If you will echo your var somewhere (to output or into file), line breaks will be separated with spaces unless you put your variable into double quotes:
Code:
shell> var="first line
> second line"
shell> echo $var
first line second line
shell> echo "$var"
first line
second line
shell>