Created
April 18, 2016 15:53
-
-
Save pca2/d47cc9bc015c63d40f066b253d08d76c to your computer and use it in GitHub Desktop.
Check the md5sums of two files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
check_md5sum(){ | |
sums=$(md5sum $1 $2) | |
file_1=$(echo $sums | awk '{print $2}') | |
file_2=$(echo $sums | awk '{print $4}') | |
checksum_1=$(echo $sums | awk '{print $1}') | |
checksum_2=$(echo $sums | awk '{print $3}') | |
if [[ "$checksum_1" == "$checksum_2" ]]; then | |
echo "OK: $file_1 and $file_2 md5 Checksums Match" | |
echo $checksum_1 $file_1 | |
echo $checksum_2 $file_2 | |
else | |
echo "ERROR: md5 checksums Mismatch" | |
echo $checksum_1 $file_1 | |
echo $checksum_2 $file_2 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment