• bash 判断两个文件相等的代码


    #!/bin/bash
    #定义参数
    username="xxx"
    passwd="xxxxxxxx"
    dbname="xxx"
    
    #判断入参为空
    if [ ! -d $# ];then
    echo "please input"
    exit 1
    fi
    
    #判断入参不为1或2
    if [ $# -ne 1 || $# -ne 2 ];then
    echo "input false"
    exit 1
    fi
    
    #执行Shoppingmall report脚本
    ./home/QA_Deploy/dp/DataExchange/program/quartz/Shopping.sh $1 $2
    
    #获取当期啊日期
    time=$(date "+%Y%m%d")
    #读取Shoppingmall report第二列兵排序保存到Shopping_mall_winning_report_$time.txt
    cat /home/QA_Deploy/dp/DataExchange/WORK/C4_SMW/Out/Shopping_mall_winning_report_$time.csv|cut -d ',' -f 2|sort > Shopping_mall_winning_report_$time.txt
    #判断是否成功
    if [ -d "Shopping_mall_winning_report_$time.txt"];then
    echo "Shopping_mall_winning_report_$time.txt"
    else
    echo "execute failed"
    fi
    
    
    #连接数据库执行SQL导出预期报表数据
    su - oracle <<EOF
    ppppppppppppppppppppppppppppppppppppppppppp;
    exit;
    EOF
    function get_test_data()
    {
    sqlplus $username/$passwd@$dbname <<!
    set linesize 5000 num 14;
    set numw 20;
    SELECT 'f', 
                 INV_CODE        as inv_code,
                 XUA_CARRIER_NO  as carrier_no,
               XUA_FULL_CNNAME as full_cnname,
               XUA_EMAIL       as email,
               XUA_MOBILE      as mobile,
                 IVP_CODE        as inv_win_code,
                 MMB_ID,
                 mmb_cst_id,
                 INV_MMB_ID,
                 XMB_MMB_ID,
                 UAC_UGR_ID,
                 XMB_BIND_UGR_ID,
                 XUA_UAC_ID,
                 UAC_ID,
                 IVP_ID,
                 INV_PRIZE_TYPE_ID,
                 INV_ID,
                 INV_CARRIERID
             
               FROM BINVOICE LEFT JOIN BMEMBERSHIP ON MMB_ID = INV_MMB_ID 
               LEFT JOIN XMEMBERSHIP       ON XMB_MMB_ID = MMB_ID 
               LEFT JOIN BUNIVERSALACCOUNT ON UAC_UGR_ID = XMB_BIND_UGR_ID 
               JOIN XUNIVERSALACCOUNT ON XUA_UAC_ID = UAC_ID 
               LEFT JOIN RINVOICEPRIZE     ON IVP_ID     = INV_PRIZE_TYPE_ID 
               WHERE  XUA_CARRIER_NO = INV_CARRIERID
               ORDER BY INV_DATE DESC,INV_ID DESC;
    exit;
    !
    }
    get_test_data|grep ^f|awk '{print$3}'|sort > /home/QA_Deploy/fang/Shopping_mall_winning_oracle_$time.txt
    
    exit;
    
    #判断是否导出成功
    if [ -d "Shopping_mall_winning_oracle_$time.txt"];then
    echo "Shopping_mall_winning_oracle_$time.csv"
    else
    echo "export failed"
    fi
    
    #将生成的Shoppingmall report与导出的预期report数据进行对比
    if [ -d "Shopping_mall_winning_oracle_$time.txt" && -d "Shopping_mall_winning_report_$time.txt" ];then
    echo "diff result-------------------------------------"
    diff Shopping_mall_winning_oracle_$time.txt Shopping_mall_winning_report_$time.txt > date_diff.log
    tail -n 100 date_diff.log
    fi
    
    
     
    

      

  • 相关阅读:
    018_STM32程序移植之_串口接收中文
    003_软件安装之_Visual Studio 2012
    001_C#我的第一个串口上位机软件
    017_STM32程序移植之_AS608指纹模块
    016_STM32程序移植之_舵机
    015_STM32程序移植之_NRF24L01模块
    014_STM32程序移植之_L298N电机驱动模块
    002_89C52_Proteus_DAC0832_输出50HZ,正弦波,三角波,矩形波,锯齿波
    001_89C52之_Proteus_ADC0809采集电压
    001_电子工程师招聘笔试题及详细解析
  • 原文地址:https://www.cnblogs.com/qianjinyan/p/9077050.html
Copyright © 2020-2023  润新知