On Tue, Nov 04, 2014 at 04:35:32PM +0100, Pino Toscano wrote:
+
+do_md5 ()
+{
+ case "$(uname)" in
+ Linux)
+ md5sum "$1" | awk '{print $1}'
+ ;;
+ *)
+ echo "$0: unknown method to calculate MD5 of file on $(uname)"
+ exit 1
+ ;;
+ esac
+}
It's probably better to do something like:
if md5sum --help >/dev/null 2>&1; then
md5sum ...
elif md5 --help >/dev/null 2>&1; then
md5 ...
else
echo "$0: don't know how to calculate md5 sum on this host"
exit 1
fi
?
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html