Skip to content

Commit

Permalink
Simplify the md5 code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sutto committed Jul 10, 2010
1 parent 08983ed commit e589535
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions scripts/md5
Expand Up @@ -7,13 +7,11 @@ md5="$2"

if [[ "Linux" = "$(uname)" ]] ; then
command="md5sum"
field="0"
elif [[ "Darwin" = "$(uname)" ]] ; then
command="/sbin/md5"
field="NF"
command="/sbin/md5 -q"
fi

file_md5=$($command "$file" | awk "{print \$$field}")
file_md5=$($command "$file" | awk '{print $0}')

if [[ "$file_md5" = "$md5" ]] ; then
exit 0
Expand Down

0 comments on commit e589535

Please sign in to comment.