#!/bin/bash while read line do echo $line done < /etc/passwd
#!/bin/bash cat /etc/passwd | while read line do echo $line done
#!/bin/bash exec 3<"/etc/passwd" while read line <&3 do echo $line done
#!/bin/bash IFS=$‘\n‘ for file in `cat /etc/passwd` do echo $file done # PS:这里的IFS格式设置不要错了,必须这么写IFS才能生效,其他方式都不对;
从执行速度上for最快、其次重定向、接着是文件描述符、最后是管道
参考文档:https://blog.csdn.net/apache0554/article/details/47006609
原文:https://www.cnblogs.com/guge-94/p/11119807.html