#!/bin/bash
while getopts f:a:h: flag
do
case "${flag}" in
f) file=${OPTARG};;
a) algo=${OPTARG};;
h) hash=${OPTARG};;
esac
done
hash_computed=($(shasum -a $algo $file))
if [[ "$hash" = "$hash_computed" ]]
then
echo "The file is not tempered!"
else
echo "The file integrity is tempered!"
fi
shasum checker bash script
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.