Advertisement
TuxyQ

Untitled

Mar 1st, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.28 KB | None | 0 0
  1. shacomp() {
  2.     if [ ! -z $1 ] ; then
  3.         echo "Comparing $1 with sha1 hash $2"
  4.         SHA=$(shasum $1 | awk '{ printf $1 }')
  5.         if [ SHA = $2 ] ; then
  6.             echo "$1 and $2 are same"
  7.         else
  8.             echo "$1 and $2 are not the same ($1 = $SHA)"
  9.         fi
  10.     else
  11.         echo "usage: shcomp <file> <sha1>"
  12.     fi
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement