I have the following bash script.
while IFS= read -r filename; do [[ $(md5 path/to/"$filename-orig") = $(md5 path/to/"$filename") ]] || echo $filename differs; done < path/to/list-of-files-to-compare.txt
It's supposed to compare two files (by computing their MD5 hash digest) then report if they are different. It gets the files to compare from a list.
The problem is that if the file I am trying to read is at, say,
the script will look for the file at
and, obviously, this throws an error and fails.
How do I correct this bug in my script so that I handle the
.js extension correctly?
Given a string
foo.bar how can I get
I add the
-orig extension because this project takes a template that's regularly updated by a third party, then I overlay my changes to it. So, I want to keep track of what files they change so I can go back and adapt my code when necessary.
list-of-files-to-compare.txt looks like the following.list-of-files-to-compare.txt
public/assets/images/logos/logo.svg README.md src/auth/Auth.js src/auth/store/actions/login.actions.js src/auth/store/actions/user.actions.js src/auth/store/reducers/user.reducer.js src/firebaseService/firebaseService.js src/firebaseService/firebaseServiceConfig.js src/fuse-configs/fuseNavigationConfig.js src/fuse-configs/fuseRoutesConfig.js src/index.js src/main/content/components/ComponentsConfig.js src/main/content/login/Login.js src/store.js src/store/actions/index.js src/store/reducers/index.js