When I use \"cat test.file\", it will show
1
2
3
4
When I use the Bash file,
cat test.file |
while read data
do
e
Just to complement DigitalRoss's response.
For that case that you want to alter the IFS just for this command, you can use curly braces. If you do, the value of IFS will be changed only inside the block. Like this:
echo '
word1
word2' | { IFS='' ; while read line ; do echo "$line" check ; done ; }
The output will be (keeping spaces):
word1 check
word2 check