- 数字性循环
#!/bin/bash
for((i=1;i<=10;i++))
do
echo $(expr $i \* 3 + 1);
done
#!/bin/bash
for i in $(seq 1 10)
do
echo $(expr $i \* 3 + 1);
done
#!/bin/bash
for i in {1..10}
do
echo $(expr $i \* 3 + 1);
done
2.字符性循环
#!/bin/bash
list="rootfs usr data data2"
for i in $list;
do
echo $i is appoint ;
done
for i in `ls`;
do
echo $i is file name\! ;
done
#!/bin/bash
for file in /proc/*;
do
echo $file is file path \! ;
done