• 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
    

      

  • 相关阅读:
    centos下卸载rpm包
    centos下添加环境变量和启动apache
    centos(linux) 下如何查看端口占用情况及杀死进程
    如何使上层的div遮住的链接可以点击
    jquery.blockUI.2.31.js 弹出层项目介绍
    fieldset、legend、display html元素
    <a>标签中href="javascript:;"的意思
    memcache 学习笔记
    sublime text3 JS语法检测插件
    Apache Rewrite的主要功能
  • 原文地址:https://www.cnblogs.com/boucher/p/5718943.html
Copyright © 2020-2023  润新知