标签:
基本步骤:
1、切换至仓库目录RPM_LIST_DIR1和RPM_LIST_DIR2
2、ls列出仓库的rpm包文件并分别重定向至输出文件rpm_list_file1和rpm_list_file2
3、将对比结果输出至差异文件difff_file
总结:
代码中看似技巧性的东西却没有用处的全部删掉,有时你忽悠的不是别人,而是你自己!
#!/bin/bash # Version: 1.0 # Date: 2016/08/09 # Author: Kevin Chen Email: cxy_ustc@163.com RPM_LIST_DIR1="/home/desktop/ds_build/ds_x86-64_install/x86-64" RPM_LIST_DIR2="/home/install_x86-64/x86_64" rpm_list_file1="/home/cxy/rpm_list_file1" rpm_list_file2="/home/cxy/rpm_list_file2" rpm_diff_file="/home/cxy/rpm_diff_file" # generate the first rpm_list_file1 cd $RPM_LIST_DIR1 count1=`ls $RPM_LIST_DIR1 | wc -l` ls $RPM_LIST_DIR1 > $rpm_list_file1 echo "There are $count1 lines in rpm_list_file1" # generate the first rpm_list_file2 cd $RPM_LIST_DIR2 count2=`ls $RPM_LIST_DIR2 | wc -l` ls $RPM_LIST_DIR2 > $rpm_list_file2 echo "There are $count2 lines in rpm_list_file2" # generate the rpm_diff_file between rpm_list_file1 and rpm_list_file2 diff -rNu $rpm_list_file1 $rpm_list_file2 > $rpm_diff_file echo "The difference between $RPM_LIST_DIR1 and $RPM_LIST_DIR2:" cat $rpm_diff_file
执行结果如下:
标签:
原文地址:http://www.cnblogs.com/noxy/p/5774315.html