Linux SHELL 逐行读取文件内容
1:#! /bin/bash IFS=" " for LINE in `cat /etc/passwd` do echo $LINE done 2:#! /bin/bash while read LINEdo echo $LINE do
·
- #! /bin/bash
- IFS="
- "
- for LINE in `cat /etc/passwd`
- do
- echo $LINE
- done
2:
- #! /bin/bash
- while read LINE
- do
- echo $LINE
- done < /etc/passwd
3:
- #! /bin/bash
- cat /etc/passwd | while read LINE
- do
- echo $LINE
- done
http://blog.csdn.net/dahual/archive/2011/04/06/6304079.aspx
更多推荐
已为社区贡献1条内容
所有评论(0)