linux shell中的迭代

来源:互联网 发布:淘宝如何搜电棍 编辑:程序博客网 时间:2024/05/21 11:14
 
1    迭代每一行:
#! /bin/bash
while read line;
do
        echo $line;
done < t.txt

2    迭代一行中的每个单词
[root@localhost test]# for word in "hello lufubo"; do echo $word; done;
hello lufubo