当我 cat 这个文件时,我得到 6 行(它是一个 diff 文件)
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
or this
bash-3.00$ cat /tmp/voo | while read line ; do echo $line ; done
18633a18634
> sashabSTP
18634a18636
> sashatSTP
21545a21548
bash-3.00$
我错过了 while 循环中的最后一行“yhee”。
Note:
21545a21548
> yheebash-3.00$
^---- no line break
您的文件不会以换行符终止。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)