cksum – compare for multiple files.
If you have to compare cksum for couple of files, the you know how cumbersome it is. So, I wrote a simple script, wherein you can create a file called cksums in the current directory and copy paste the result of “**cksums ***” into this file, and then run this script. Cool 🙂
#!/bin/bash - #=============================================================================== # # FILE: checkcksums.sh # # USAGE: ./checkcksums.sh # # DESCRIPTION: Compare cksums of multiple files. # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Amit Agarwal (), # ORGANIZATION: # CREATED: 02/22/2013 09:12:17 PM IST # REVISION: --- #=============================================================================== file=cksums while read line do a=( $(echo $line) ) if [[ -f ${a[2]} ]] then b=( $(cksum ${a[2]}) ) if [[ $a == $b ]] then echo "Cksum for ${a[2]} = ${a[0]} matches" else echo "Failed ::Cksum for ${a[2]} = ${a[0]} matches" fi else echo "Failed :: file ${a[2]} does not exist" fi done < $file
Related articles
Related Articles:
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.