I have a file with 3 separate lines, when I read the file content into a variable, for some reason the new lines are replaced with spaces, how can I prevent it so the variable will contain new lines instead spaces?
[root@ tmp]# cat xxx
aaa
bbb
ccc
[root@ tmp]# x=`cat xxx`
[root@ tmp]# echo $x
aaa bbb ccc
[root@ tmp]# echo $x | od -c
0000000   a   a   a       b   b   b       c   c   c  \n
0000014
[root@ tmp]# cat xxx | od -c
0000000   a   a   a  \n   b   b   b  \n   c   c   c  \n
0000014
