I have a text file test.txt with the following content:
text1
text2
And I want to assign the content of the file to a UNIX variable but when I do this:
testvar=$(cat test.txt)
echo $testvar
the reult is:
text1 text2
instead of
text1
text2
Can someone suggest me a solution for this?