md5sum.sh 297 B

123456789101112131415161718
  1. #!/bin/sh
  2. check_command() {
  3. which $1 >/dev/null 2>&1
  4. }
  5. if check_command md5sum; then
  6. ret="$(md5sum "$@")"
  7. elif check_command md5; then
  8. ret="$(md5 -q "$@")"
  9. else
  10. echo "$0: no suitable md5sum implementation was found" >&1
  11. exit 1
  12. fi
  13. [ "$?" -eq 0 ] || exit 1
  14. echo "$ret" | awk '{ print $1 }'