shell 脚本读取文件内容并输出--问题总结(编码问题)

shell脚本读取文件主要介绍两种方式:

第一种:

#/bin/bash
while read line
do
   echo $line
done < a.txt

第二种:

#/bin/bash
cat a.txt | while read line
do
   echo $line
done

posted @ 2019-01-07 20:00  小Aer  阅读(329)  评论(0编辑  收藏  举报