Basic steps:
1. Switch to the warehouse directory Rpm_list_dir1 and RPM_LIST_DIR2
2. LS lists the RPM package files of the warehouse and redirects them to the output files Rpm_list_file1 and Rpm_list_file2 respectively.
3. Output the comparison results to the diff file Difff_file
Summarize:
The seemingly tricky things in code are all erased, and sometimes you are not the others, but yourself!
#!/bin/bash# version:1.0# Date: 2016/08/09# author:kevin chenemail: [email protected]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_FILE1CD $RPM _list_dir1count1= ' ls $RPM _list_dir1 | Wc-l ' ls $RPM _list_dir1 > $rpm _list_file1echo "There is $count 1 lines in Rpm_list_file1" # Generate the first rpm_list_ FILE2CD $RPM _list_dir2count2= ' ls $RPM _list_dir2 | Wc-l ' ls $RPM _list_dir2 > $rpm _list_file2echo "There is $count 2 lines in Rpm_list_file2" # Generate the Rpm_diff_file b Etween Rpm_list_file1 and Rpm_list_file2diff -rnu $rpm _list_file1 $rpm _list_file2 > $rpm _diff_fileecho "the Difference between $RPM _list_dir1 and $RPM _list_dir2: "Cat $rpm _diff_file
The results of the implementation are as follows:
How the shell generates RPM package warehouse list file comparison results