字體:小 中 大 |
|
|
|
| 2020/03/04 15:55:52瀏覽71|回應0|推薦0 | |
#!/bin/bash
# sh for chcecking .iso and .iso.md5
#assume, there are
# a.iso b.iso c.iso
# a.iso.md5 b.iso.md5 c.iso.md5
if [ "$1" != "gcat" ]; then
echo "No safekey and exit"
echo "Ex: ./auto_chk_md5.sh gcat"
echo "Ex: ./auto_chk_md5.sh gcat other_path/"
exit
fi
rm *.iso.md5~
if [ -f "tmp.txt" ]; then
rm tmp.txt
fi
#ls -l *.iso *.tar *.zip > tmp.txt
find $2 -iname "*.md5" > tmp.txt
n_todo=`cat tmp.txt | wc -l`
n_doing=0
#---
while read st1
do
n_doing=$(($n_doing+1))
echo "$n_doing/$n_todo"
st_filename_md5=`echo $st1`
echo " $st_filename_md5"
i_st_filename_md5=`echo $st_filename_md5 | wc -L`
i_st_filename_md5=$(($i_st_filename_md5 - 4 ))
st_filename_iso=`echo $st_filename_md5 | cut -c1-$i_st_filename_md5`
if [ ! -f "$st_filename_iso" ]; then
echo " WARNING !!! $st_filename_iso not found"
else
exp_md5=`cat $st_filename_md5 | awk {print $1}`
echo " exp=$exp_md5"
act_md5=`md5sum $st_filename_iso | awk {print $1}`
#act_md5=$exp_md5
if [ "$exp_md5" == "$act_md5" ]; then
echo " ok"
else
echo " act=$act_md5"
echo " Err and exit"
exit
fi
fi
done < tmp.txt
#---
rm tmp.txt
echo "done"
|
|
| ( 創作|散文 ) |










