shell脚本中每次读取文件的一行

写法一:
#!/bin/bash
while read line
do
      echo $line     #这里可根据实际用途变化
done < file          #需要读取的文件名

_____________________________________________________

写法二:

#!/bin/bash

cat urfile | while read line
do
    echo $line
done

posted on 2014-04-08 16:01  小风儿_xf  阅读(401)  评论(0编辑  收藏  举报

导航