I have extracted a 7-zip binary file and I want to compare two hashfile outputs to ensure they are the same. I am calling the file.sh in 'git bash' not in wsl because that is what we have access to. Note that means the environment is MINGW64 so I an unsure if that changes the shell script.
In foe.txt:
line explaining how to get hashfile
other notes
last line
SHA384: 32930dae794520cf08db88d0ef9fb123eff51b7e92b6fd91bb8ea722d67e19260c093c95c8ed693fecc598f342113442
Then backpedal the folder and certutil the lib file to get the hash number and compare the two.
When just doing a while loop and echo line it stops before the last line. But there is no error until I add the if statement then it fails on done
If I try the for loop after the folder back it fails on fi. Therefore the syntax or "meat" of the if and for statements are causing an error.
#!/bin/bash
while read -r line
do
if [SHA: in line]
do
set serial=$line
done < foe.txt # error syntax near unexpected token
cd ../
set hashfil=sha384sum foe.lib
# example hash: 32930dae794520cf08db88d0ef9fb123eff51b7e92b6fd91bb8ea722d67e19260c093c95c8ed693fecc598f342113442 *foe.lib
if [hashfil in serial]
echo "valid"
else
echo "double check hash"
fi