「shell学習」md5sumチェックサムを計算するshellプログラム
shellコード下記:
#!/bin/sh
if [ $# = “2" ] || [ $# = “1" ];
then
md5text=`md5sum $1`
for item in $md5text;
do
break
done
if [ $# = “2" ];
then
if [ “$item" = “$2" ];
then
echo “\033[32m$item\033[0m"
else
echo “\033[31m$item\033[0m"
fi
else
if [ $# = “0" ];
then
md5sum –help
fi
fi
if [ $# = “1" ];
then
echo “\033[36m$item\033[0m"
fi
fi