Skip to content

Instantly share code, notes, and snippets.

@chrisxaustin
Created April 28, 2016 22:04
Show Gist options
  • Save chrisxaustin/e690a229e29fdfa844edea1e3f78e08a to your computer and use it in GitHub Desktop.
Save chrisxaustin/e690a229e29fdfa844edea1e3f78e08a to your computer and use it in GitHub Desktop.
Bash script for searching jars under a set of directories
#!/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