写法一:

----------------------------------------------------------------------------

!/bin/bash



while read line

do

echo $line

< filename(待读取的文件)

----------------------------------------------------------------------------



写法二:

----------------------------------------------------------------------------

!/bin/bash



(待读取的文件) | while read line

do

echo $line

done

----------------------------------------------------------------------------



写法三:

----------------------------------------------------------------------------

for line in `cat filename(待读取的文件)`

do

echo $line

done