# With shell scripting, one needs to always quote variables, especially when working with strings.
# Here is an example of the problem:
# Example variable:
$ f="fafafda
> adffd
> adfadf
> adfafd
> afd"
# Output without quoting the variable:
$ echo $f
fafafda adffd adfadf adfafd afd
# Output WITH quoting the variable:
$ echo "$f"
fafafda
adffd
adfadf
adfafd
afd
# Explaination:
# Without quotes, the shell replaces $TEMP with the characters it contains (one of which is a newline). Then, before invoking echo shell splits that string into multiple arguments using the Internal Field Separator (IFS), and passes that resulting list of arguments to echo. By default, the IFS is set to whitespace (spaces, tabs, and newlines), so the shell chops your $TEMP string into arguments and it never gets to see the newline, because the shell considers it a separator, just like a space.