[mdlug] Scripting - Newlines getting clobbered?
Clinton V. Weiss
cvweiss at gmail.com
Thu Dec 27 00:13:38 EST 2007
You might want to try using $() rather than backticks ``, it allows
for easier nesting of commands
Example:
VAR="$(cat data)"
echo $VAR
Also, depending on what you're doing:
while read line ; do
echo $line
# ... do stuff with the line of data ...
done < data
Here is a good resource for the budding bash scripter:
http://wooledge.org:8000/BashFAQ
It's a large page and a bit slow to load (Greg refuses to acknowledge
the slow part) but is an excellent resource. I recommend wget'ing it
for quick local access.
--
Clinton V. Weiss
cvweiss at gmail.com
More information about the mdlug
mailing list