标签:
代码:
#!/bin/bash echo 方法1 while read line do echo $line; done < testdata echo "" echo 方法2 cat testdata | while read line do echo $line done echo "" echo 方法3 oldIFS=${IFS}; IFS=$‘\n‘; for line in $(cat testdata) do echo $line done IFS=${oldIFS};
文件 testdata:
abc
def
df ab cd
asas
标签:
原文地址:http://www.cnblogs.com/DengGao/p/5935688.html