自动更新Fedora17的二进制包

#!/bin/bash
ulrpm="http://mirrors.sohu.com/fedora/development/17/x86_64/os/Packages/"
char="0
3
4
9
a,A
b,B
c,C
d,D
e,E
f,F
g,G
h,H
i,I
j,J
k,K
l,L
m,M
n,N
o,O
p,P
q,Q
r,r
s,S
t,T
u,U
v,V
w,W
x,X
y,Y

z,Z"

dd=`date +%Y%m%d%H%M`
mkdir -p /FC17-download-20120331/{Old-$dd,New-$dd}
cd /FC17-download-20120331/rpm
rm -rf index.html*

for cmd in $char
do
    ls [$cmd]*.rpm &>rpm.list
    wget $ulrpm`echo $cmd|cut -c1`
    for i in `cat rpm.list`
    do
        grep $i index.html &>/dev/null
        if [ $? != 0 ];then
            mv $i /FC17-download-20120331/Old-$dd
            echo "Mv $i -> Old"
            ls "$i" &>> /FC17-download-201203331/Old-$dd/Old.list
        else
            ls "$i" &>> /FC17-download-20120331/Old-$dd/exist.list
        fi
    done
    wwget $ulrpm`echo $cmd|cut -c1`/
    rm -rf index.html*
done

ls /FC17-download-20120331/rpm/*.rpm >/FC17-download-20120331/Old-$dd/all.list
for j in `cat /FC17-download-20120331/Old-$dd/all.list`
do
    grep $j /FC17-download-20120331/Old-$dd/exist.list
    if [ $? != 0 ];then
        cp $j /FC17-download-20120331/New-$dd/
        ls $j &>>/FC17-download-20120331/New-$dd/new.list
    fi
done

echo "Do!"


Type the name of a command and press enter to execute it, or help for assistance.

你可能感兴趣的:(shell)