Skip to content

Instantly share code, notes, and snippets.

@photonxp
Last active September 11, 2018 11:53
Show Gist options
  • Save photonxp/3d30689ba49ade34d7691be3f771e873 to your computer and use it in GitHub Desktop.
Save photonxp/3d30689ba49ade34d7691be3f771e873 to your computer and use it in GitHub Desktop.
compare generated-sha1sum of a given file to a sum_string
#!/bin/bash
# Usage:
# sha1sum_file_vs_sumstr.sh /path/to/file sum_str
sha1sum "$1"
sha1_result=$(sha1sum "$1")
sum=${sha1_result%% *}
echo
echo $sum
diff <(echo $sum) <(echo $2) && echo "Compare is OK."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment