Created
July 22, 2010 11:24
-
-
Save trygvis/485855 to your computer and use it in GitHub Desktop.
Utility to create an index of all JAR files recursively
This file contains 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
$ cat ~/bin/jarindex | |
#!/bin/bash | |
if [ -x /opt/csw/bin/gawk ] | |
then | |
awk=/opt/csw/bin/gawk | |
else | |
awk=awk | |
fi | |
if [ ! -x `which awk` ] | |
then | |
echo "Unable to execute awk: $awk" > /dev/stderr | |
exit 1 | |
fi | |
if [ -r jarindex ] | |
then | |
cp jarindex jarindex.tmp | |
else | |
rm -f jarindex.tmp | |
fi | |
for jar in `find . -name '*.jar'|sort` | |
do | |
if [ jarindex -ot "$jar" ] | |
then | |
# continue | |
# else | |
echo Indexing: $jar | |
jar ft $jar | $awk -v jar=$jar '{printf("%s:%s\n", jar, $1)}' >> jarindex.tmp | |
fi | |
done | |
[ -r jarindex.tmp ] && mv jarindex.tmp jarindex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment