当我捕获这个文件时,我得到6行(这是一个差异文件)
bash-3.00$ cat /tmp/voo 18633a18634 > sashabSTP 18634a18636 > sashatSTP 21545a21548 > yheebash-3.00$
然而,当我逐行阅读时,我只得到5行.
bash-3.00$ while read line ; do echo $line ; done < /tmp/voo 18633a18634 > sashaSTP 18634a18636 > sashatSTP 21545a21548
或这个
bash-3.00$ cat /tmp/voo | while read line ; do echo $line ; done 18633a18634 > sashabSTP 18634a18636 > sashatSTP 21545a21548 bash-3.00$
我错过了while循环中的最后一行'yhee'.
注意:
21545a21548 > yheebash-3.00$ ^---- no line break
您的文件不会以换行符结束.