shell脚本:一次读取文件的一行【转】

写法一:
#!/bin/bash
while read line
do
      echo $line     #这里可根据实际用途变化
done < urfile
写法二:
#!/bin/bash
cat urfile | while read line
do
    echo $line
done
注意:以上代码中urfile 为被读取的文件

posted on 2010-10-31 11:46  nwf  阅读(264)  评论(0编辑  收藏  举报

导航