1.使用while
#!/bin/bash while read line do echo $line done < file.txt
#!/bin/bash cat file.txt | while read line do echo $line done
2.使用for
for line in `cat file.txt` do echo $line done