Skip to content

Instantly share code, notes, and snippets.

@theminer3746
Last active February 23, 2021 08:02
Show Gist options
  • Save theminer3746/32d06315e1c2a9a83afbf6e11f41916a to your computer and use it in GitHub Desktop.
Save theminer3746/32d06315e1c2a9a83afbf6e11f41916a to your computer and use it in GitHub Desktop.
#!/bin/sh
if [[ ! -f sample.txt ]]; then
echo "Error : Sample.txt does not exist.";
exit;
fi
ORIGINAL_HASH=$(cat hash.txt);
NEW_HASH=$(openssl sha1 sample.txt);
if [ "$ORIGINAL_HASH" = "$NEW_HASH" ];
then
echo "Test PASSED : Hash matched";
else
echo "Test FAILED : Hash does not match";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment