shell 循环

 

for循环:

 

 批量删除.gz结尾的文件:

 

 循环打包文件并备份到一个目录下面:

find ./ -maxdepth 1 -name "*.gz"

find ./ -maxdepth 1 -d -name "*.gz"

 

批量传输文件:

 

 

 while循环语法:

条件不满足就退出

[root@linux1 script]# cat circle.sh
#!/bin/bash
i=0
while [[ $i -lt 4 ]]
do
  echo $i
  ((i++))
done
[root@linux1 script]# sh circle.sh
0
1
2
3

 

 

 while循环读取文件:(可以配合for循环等批量执行等)

 

 

until循环:

条件满足就退出

 

posted @ 2016-10-05 10:17  xuanhui  阅读(130)  评论(0编辑  收藏  举报