码迷,mamicode.com
首页 > 系统相关 > 详细

shell如何生成rpm包仓库列表文件的对比结果

时间:2016-08-15 22:11:22      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:

基本步骤:

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

执行结果如下:

技术分享

shell如何生成rpm包仓库列表文件的对比结果

标签:

原文地址:http://www.cnblogs.com/noxy/p/5774315.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!