shell命令一行一行读取文件数据

来源:互联网 发布:学做淘宝视频教程全集 编辑:程序博客网 时间:2024/06/09 20:58

用while和read命令

脚本命令如下:

#! /bin/sh

while read line

do

    echo $line

done < filename

(filename是准备要读取的文件名)

注意:不要写成这样:

#! /bin/sh

while read line

do

    echo $line

done

运行时会进入死循环!!!

 

原创粉丝点击