I'm new to bash (ksh only up until now). I'm struggling with whitespace being striped from variables. I've read a number posts on bash's treatment of leading whitespace but I'm not sure how to correct it in my example.
echo "No space" > x.tmp
echo " Some space" >> x.tmp
cat x.tmp
cat x.tmp | while read line
do
echo "$line" >> y.tmp
done
cat y.tmp
Output:
No space
Some space
No space
Some space
What do I need to do to preserve the whitespace?
Thanks.