echo " a" | while read; do echo "$REPLY"; done
will output ".....a" which contains leading white space. However,
echo " a" | while read line; do echo "$line"; done
will output "a" with leading white space skipped (OK, because word splitting).
It seems the REPLY variable has the same effect of IFS set to null:
echo " a" | while IFS= read line; do echo "$line"; done
From the bash manual, I can't find the reason. Do you have any ideas? Thanks.