Created
January 21, 2026 04:40
-
-
Save jimdiroffii/91e426950e4c7fe190766d4d66648482 to your computer and use it in GitHub Desktop.
SHA256 Checksum
This file contains hidden or 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
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| expected="${1:?usage: $0 <expected_sha256> <file>}" | |
| file="${2:?usage: $0 <expected_sha256> <file>}" | |
| actual="$(sha256sum -- "$file" | awk '{print $1}')" | |
| if [[ "${actual,,}" == "${expected,,}" ]]; then | |
| echo "OK: SHA256 Match" | |
| exit 0 | |
| else | |
| echo "FAIL: SHA256 Does Not Match" | |
| echo "expected: $expected" | |
| echo "actual: $actual" | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment