網路城邦
上一篇 回創作列表 下一篇   字體:
linux script file for auto checking iso md5
2020/02/27 15:03:13瀏覽40|回應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"
( 知識學習語言 )
回應 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=greatcat&aid=131855781