Reading file into variable, and losing line feeds
Ray Parrish
crp at cmc.net
Sat Nov 28 03:22:55 UTC 2009
Hello,
I am interested in being able to read the contents of a text file into a
variable, complete with line feeds.
Here is what I tried -
ray at RaysComputer:~/Bashscripts$ cat test.txt
Line 1
Line 2
Line 3
Line 4
Line 5
ray at RaysComputer:~/Bashscripts$ FileContents=`cat test.txt`
ray at RaysComputer:~/Bashscripts$ echo $FileContents
Line 1 Line 2 Line 3 Line 4 Line 5
ray at RaysComputer:~/Bashscripts$
Is there some trick to preserving the line feeds in the variable?
Thanks for any help you can be, Ray Parrish
--
The Future of Technology.
http://www.rayslinks.com/The%20Future%20of%20Technology.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com
More information about the ubuntu-users
mailing list