zoukankan      html  css  js  c++  java
  • shell中的一些技巧和知识

    写了两天脚本,不懂什么就网上搜,感觉零零碎碎学了不少东西,先把代码贴上来,明天周末有空一条一条找知识点吧

    #!/bin/bash
    # by wuboxiao
    
    rm -rf checkConfig.diff checkConfig.same checkConfig.error checkConfig.result
    files=`find $1/src/main/resources/performance -name "*.properties"`
    for i in $files;do
        diff $i ${i/performance/stable} 1>>checkConfig.result 2>>checkConfig.result
        if [ $? -eq 0 ]; then
           echo $i,${i/performance/stable} 1>>checkConfig.same
        else
           diff $i ${i/performance/stable} -y 1>>checkConfig.result 2>>checkConfig.result
           if [ $? -eq 1 ];then  
              echo $i,${i/performance/stable} 1>>checkConfig.diff
              diff $i ${i/performance/stable} -y --suppress-common-lines 1>>checkConfig.diff
           elif [ $? -eq 2 ];then 
              echo "结果为2"
           else  diff $i ${i/performance/stable} -y 2>>checkConfig.error
           fi
           echo -e "
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        fi
    done
    echo -e "e[1;31m配置文件缺失检查结果:e[0m"
    if [ ! -f checkConfig.error ];then 
       echo "无配置文件缺失"
     else cat checkConfig.error
    fi
    echo -e "e[1;31m配置文件不同检查结果:e[0m"
    if [ ! -f checkConfig.diff ];then 
       echo "无不同的配置文件"
    else cat checkConfig.diff
    fi
     if [ $# -eq 2 ];then
       echo -e "e[1;31m配置文件相同检查结果:e[0m"
       if [ ! -f checkConfig.same ];then 
          echo "无相同的配置文件"
       else cat checkConfig.same
     fi
    fi
    

      

  • 相关阅读:
    第15周作业
    软件工程结课作业
    第13次作业--邮箱的正则表达式
    第12次作业
    第10次作业
    Java 8 新的时间日期库
    你还在用if-else吗?
    Java并发编程:4种线程池和缓冲队列BlockingQueue
    ZooKeeper学习第八期——ZooKeeper伸缩性(转)
    ZooKeeper学习第七期--ZooKeeper一致性原理(转)
  • 原文地址:https://www.cnblogs.com/boucher/p/5718943.html
Copyright © 2011-2022 走看看