I have the following bash script.
while IFS = read -r filename; make [[ $(md5 path/to/"$filename-orig") = $(md5 path/to/"$filename") ]]|| echo $ filename differs; done <path / to / list-of-files-to-compare.txt
It is supposed to compare two files (by calculating their MD5 fingerprint), then indicate if they are different. The files are compared from a list.
The problem is that if the file I'm trying to read is at, say,
path / to / foo-orig.js
the script will look for the file to
path / to / foo.js-orig
and, of course, this throws an error and fails.
How can I fix this bug in my script so that I handle the
js extension correctly?