心在远方

导航

shell 逐行读取文件

shell安行读取文件,三种方法

#/usr/bin/bash
while read line
do
echo $line
done < filename #带读取的文件
#!/usr/bin/bash
cat filename | while read line
do
echo $line
done
#!/usr/bin/bash
for
line in `cat filename` do echo $line done

 

posted on 2018-08-29 21:10  韩伟123  阅读(177)  评论(0)    收藏  举报