# cat file
note:
this a note
a simple note
a very very simple note
# var=$(<file)
# echo "$var"
note:
this a note
a simple note
a very very simple note
They are there, but doing echo $var instead of echo "$var" has the side-effect of flattening out all whitespace.
What are you attempting by putting an entire file in a variable? There's probably better and safer ways to do what you want. Many shells have a variable size limit, so this is only guaranteed to work when the file is tiny...
Yes, but what are you attempting by putting an entire file in a variable? There's probably better and safer ways to do what you want. As you've already discovered, it can have unintended side-effects.