I want a simple bash command to compare two hash values that outputs whether they are the same. Here's what I've tried:
md5sum file1 | awk '{print $1}' # outputs hash value without filename
md5sum file1 > md5sum file2 # no output even though files/hashes differ
I've tried variations on the following with no success so far:
[ md5sum states.txt | awk '{print $1}' == md5sum states_copy.txt | awk '{print $1}' ]`
[ (md5sum states.txt | awk '{print $1}') == (md5sum states_copy.txt | awk '{print $1}') ]
I'm open to a script or multi-line bash solution, or using shasum, but I'm new to Linux and bash so trying to keep it as simple as possible.
I'm running Ubuntu 18.04.
[ "$(<states.txt md5sum)" = "$(<states_copy.txt md5sum)" ]
$(...)
to get command output$(...)
inside "
=
for string comparision, not double ==
<
redirection.