#!/usr/bin/env bash if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi args=($*) file="${args[0]}" md5="${args[1]}" args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing. if [[ "Linux" = "$(uname)" ]] ; then command="md5sum" elif [[ "Darwin" = "$(uname)" ]] ; then command="/sbin/md5 -q" fi file_md5=$($command "$file" | awk '{print $1}') if [[ "$file_md5" = "$md5" ]] ; then exit 0 else exit 1 fi