Created
April 28, 2016 22:04
-
-
Save chrisxaustin/e690a229e29fdfa844edea1e3f78e08a to your computer and use it in GitHub Desktop.
Bash script for searching jars under a set of directories
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
#!/bin/bash | |
# Usage: findjar <class name or pattern> <directories> | |
# Example: findjar StringUtils . | |
class=$1 | |
shift | |
for f in `find $* -type f -name "*.jar"`; do | |
match=$(jar tf $f 2>/dev/null| grep $class); | |
if [[ -n "$match" ]]; then | |
echo | |
echo $f; | |
echo "$match" | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment