[Help-bash] loading a file into a variable using cat
From:
Lakshman Siddardha
Subject:
[Help-bash] loading a file into a variable using cat
Date:
Fri, 22 Sep 2017 19:31:03 +0530
file:list
----------------------------------------
hello
world
----------------------------------------
when i type on terminal the following command:
$ cat $file
it displays as it is in file
----------------------------------------
hello
world
----------------------------------------
when i execute a shell script, it gives output in one line only
---------------------------------------
ex.sh
----------------------------------------
lista=$(cat list)
echo $lista
-------------------------------------
it gives output of
--------------------------
hello world
-------------------------
i want new line character between "hello" and "world"