shell readline
shell 的readline功能,read就能直接干了
方式如下
1. 读取重定向
#!/bin/bash while read line do echo $line done < test.txt
2. 输出给管道
#!/bin/bash cat test.txt | while read line do echo $line done
3. for 循环搞定
for line in `cat test.txt` do echo $line done