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
    

      

  • 相关阅读:
    Web 呼起 APP
    移动端监测离开页面
    input 呼起数字键盘
    建站工具Hexo
    linux 查找并kill进程
    linux php --ini
    Git + BeyondCompare
    Linux连续执行多条命令
    chrome start.js报错
    emoji和utf8mb4字符集
  • 原文地址:https://www.cnblogs.com/boucher/p/5718943.html
Copyright © 2011-2022 走看看