md5.sh 516 Bytes
Newer Older
1 2
# try to find an md5 program

3
if [ X"$(echo | md5sum -b 2> /dev/null)" != X ]; then
4
    do_md5sum() { md5sum -b $1; }
5 6
elif [ X"$(echo | command md5 2> /dev/null)" != X ]; then
    do_md5sum() { command md5 $1 | sed 's#MD5 (\(.*\)) = \(.*\)#\2 *\1#'; }
7 8
elif [ -x /sbin/md5 ]; then
    do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
9 10
elif openssl version >/dev/null 2>&1; then
    do_md5sum() { openssl md5 $1 | sed 's/MD5(\(.*\))= \(.*\)/\2 *\1/'; }
11 12 13
else
    do_md5sum() { echo No md5sum program found; }
fi