Created
October 9, 2012 02:50
-
-
Save lifning/3856292 to your computer and use it in GitHub Desktop.
Quick and dirty script to get multiple types of checksum for a file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dir=$(mktemp -d) | |
cmd="cat \"${1}\" | tee" | |
shift | |
sums="md5 sha1" | |
if [ ! -z "${*}" ] ; then | |
sums="${@}" | |
fi | |
for i in ${sums} ; do | |
cmd="${cmd} >(${i}sum - > \"${dir}/${i}\")" | |
done | |
bash -c "${cmd} > /dev/null" | |
pushd "${dir}" > /dev/null | |
for i in ${sums} ; do | |
echo -ne "${i}\t: " | |
awk '{ print $1 }' < $i | |
done | |
popd > /dev/null | |
rm -r "${dir}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wrote this for the purpose of piping it into zenity in a Thunar action:
get-checksums.sh %f | zenity --text-info --width=500