Skip to content

Instantly share code, notes, and snippets.

@yyuu
Created November 14, 2012 11:26
Show Gist options
  • Select an option

  • Save yyuu/4071634 to your computer and use it in GitHub Desktop.

Select an option

Save yyuu/4071634 to your computer and use it in GitHub Desktop.
display digests of all class files in jar
#!/bin/sh
abspath() {
( cd $(dirname $1) && echo "$(pwd)/$(basename $1)" )
}
for _jar in "$@"; do
jar=$(abspath $_jar)
tmpdir=$(mktemp -d)
cd "${tmpdir}" && {
jar xf "${jar}"
find . -type f -and -name '*.class' -print0 | xargs -0 --no-run-if-empty sha1sum -- | sort -k2
}
rm -rf "${tmpdir}"
done
# vim:set ft=sh :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment