#!/bin/bash
#by:V log_dir=(/data/logs/anjubao_syncapi /data/logs/anjubao_wechat)
daytime=`date -d ' -1 day ' +%Y%m%d`
datatemp=/data/debugtemp if [ ! -d $datatemp ];then
mkdir -p $datatemp
fi for i in ${log_dir[@]}
do if [ ! -d $i ];then
echo 'log_dir error'
exit 0
fi logname1=`ls -lt --time-style="+%Y%m%d" $i|grep -w $daytime|awk ' NR==1 {print $7}'`
logname2=`ls -lt --time-style="+%Y%m%d" $i|grep -w $daytime|awk ' NR==2 {print $7}'`
logname3=`ls -lt --time-style="+%Y%m%d" $i|grep -w $daytime|awk ' NR==3 {print $7}'`
logname4=`ls -lt --time-style="+%Y%m%d" $i|grep -w $daytime|awk ' NR==4 {print $7}'`
logname5=`ls -lt --time-style="+%Y%m%d" $i|grep -w $daytime|awk ' NR==5 {print $7}'`
logname6=`ls -lt --time-style="+%Y%m%d" $i|grep -w $daytime|awk ' NR==6 {print $7}'`
logname7=`ls -lt --time-style="+%Y%m%d" $i|grep -w $daytime|awk ' NR==7 {print $7}'`
logname8=`ls -lt --time-style="+%Y%m%d" $i|grep -w $daytime|awk ' NR==8 {print $7}'`
tag=`echo $i|awk -F"/" '{print $4}'`
cd $i tar -czf $datatemp/ip175_$daytime-$tag.tar.gz $logname1 $logname2 $logname3 $logname4 $logname5 $logname6 $logname7 $logname8 if [ $? -eq 0 ];then
echo "hh"

Shell 脚本元组+for循环的更多相关文章

  1. shell脚本之for循环

    shell脚本之for循环 author :headsen  chen       2017-10-18    09:50:41 个人原创,转载请注明.否则依法追究法律责任 1,cat forloop ...

  2. shell 脚本中所有循环语法

    写出 shell 脚本中所有循环语法 for 循环 : for i in $(ls);do echo item:$i done while 循环 : #!/bin/bash COUNTER=0 whi ...

  3. centos shell脚本编程2 if 判断 case判断 shell脚本中的循环 for while shell中的函数 break continue test 命令 第三十六节课

    centos  shell脚本编程2 if 判断  case判断   shell脚本中的循环  for   while   shell中的函数  break  continue  test 命令   ...

  4. shell脚本中select循环语句用法

    shell脚本中select循环语句 1. 脚本中select的语法格式 select VAR in LIST do command1 command2 ... ... commandN done s ...

  5. shell脚本进阶之循环判断

    p.MsoNormal,li.MsoNormal,div.MsoNormal { margin: 0cm; margin-bottom: .0001pt; text-align: justify; f ...

  6. shell 脚本中for循环

    昨天很痛苦的搞了一天的for循环,在服务器上运行没啥问题,在设备上运行总是不行,部分代码如下: for(i=1;i<$cnt+1;i++)do echo "xxxx"  &g ...

  7. Shell脚本- 单条命令循环执行重复工作

    关于shell for循环具体详细说明可参考:http://wiki.jikexueyuan.com/project/linux-command/chap34.html example: 分别在com ...

  8. shell脚本程序中循环、判断语句的介绍

    shell的循环主要有3种,for,while,until shell的分支判断主要有2种,if,case 一,for循环 C/C++ Code复制内容到剪贴板 #!/bin/bash for fil ...

  9. Shell脚本之for循环、while循环,if语句、case语句

    1. for循环一般格式: 格式1: for((条件)) do 动作 done 格式2: for 变量名 in 范围 do 动作 done1234567891011121314实验:##1. 输出数字 ...

随机推荐

  1. JS设计模式(13)状态模式

    什么是状态模式? 定义:将事物内部的每个状态分别封装成类,内部状态改变会产生不同行为. 主要解决:对象的行为依赖于它的状态(属性),并且可以根据它的状态改变而改变它的相关行为. 何时使用:代码中包含大 ...

  2. Spring中使用@Value读取porperties文件中的属性值方法总结及注意事项

    本文为博主原创,转载请注明出处. 此前曾总结过使用工具类读取properties文件中的属性值,有兴趣的可以看一下. 如何快速获取properties中的配置属性值:https://www.cnblo ...

  3. Selenium(基于JAVA语言)-》在eclipse上运行web项目在Mac系统上启动时提示nodename nor servname provided解决办法

    最近使用eclipse进行自动化测试时,遇到一种情况,无法调起浏览器,且有报错,如下: org.openqa.selenium.WebDriverException: failed to lookup ...

  4. A_Pancers团队作业4—基于原型的团队项目需求调研与分析

    任务1:实施团队项目软件用户调研活动. (1)用户调研对象:我们的项目软件是基于安卓系统的音乐播放器,以设计出操作简单的音乐播放器为目的,所以本次用户调研的对象主要以身边的老人为主,对他们听音乐,听戏 ...

  5. All You Can Code 2008 (Romanian Contest) A - Tree Search

    A - Tree Search 思路: 经典树形dp dp[i][0]表示i的子树中以i为端点的最大链 dp[i][1]表是整棵树中除去i的子树剩下的部分以i为端点的最大链 最后答案就是以i为端点的最 ...

  6. box-sizing 和 dom width

    refer : https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model/Determining_the_dimensions ...

  7. 雷林鹏分享:jQuery EasyUI 数据网格 - 创建属性网格

    jQuery EasyUI 数据网格 - 创建属性网格 属性网格(property grid)带有一个内置的 expand(展开)/collapse(合并) 按钮,可以简单地为行分组.您可以简单地创建 ...

  8. Gerapy的简单使用

    1. Scrapy:是一个基于Twisted的异步IO框架,有了这个框架,我们就不需要等待当前URL抓取完毕之后在进行下一个URL的抓取,抓取效率可以提高很多. 2. Scrapy-redis:虽然S ...

  9. js 里面的那些节省字节的写法 a|0 void 0等等

    //取整 parseInt(a,10); Math.floor(a); ~~a; //节省之后的写法 a|0; //节省之后的写法 //四舍五入 Math.round(a); a+.5|0; //节省 ...

  10. [hdu P1599] find the mincost route

    [hdu P1599] find the mincost route 杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V ...