Contents ...
udn網路城邦
linux script file for auto checking iso md5
2020/02/27 15:03
瀏覽36
迴響0
推薦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 [ -f "tmp.txt" ]; then

rm tmp.txt

fi

ls -l | grep iso.md5 > tmp.txt

#---

while read st1

do

st_filename_md5=`echo $st1 | awk '{print $NF}'`

st3=`cat $st_filename_md5`

st_filename_iso=`echo $st3 | awk '{print $2}'`


echo "calculate md5 of $st_filename_iso"

st_result_md5=`md5sum $st_filename_iso`

if [ "$st_result_md5" == "$st3" ]; then

echo "OK"

else

echo "!!! ERROR !!!"

exit

fi

done < tmp.txt

echo "done"
全站分類:知識學習 語言
自訂分類:linux
上一則: sdcard image
下一則: ubuntu 16 倉頡

限會員,要發表迴響,請先登入