Repair a backup verifier that reports success after failure.
Instruction: Write a complete Bash verifier with meaningful exit codes and no success output after failed validation.
The broken fictional verifier runs gzip -t "$archive" and then unconditionally prints verified. Replace it with a script taking exactly two arguments: a readable regular gzip file and its trusted expected SHA-256 as 64 lowercase hexadecimal characters. Use Bash, shasum and gzip. Print verified only when both digest and gzip integrity checks pass. Return 2 for invalid arguments and 1 for validation or tool failure. The local artifact is immutable during these checks. Do not extract or modify it.
gzip -t "$archive"
echo verifiedUpdated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
The final echo can hide the preceding command's failure because it succeeds...
Related Questions
-
easy
-
easy
-
easy
-
easy
-
easy
-
easy