Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###############################################################################
- # Search for JARs containing the given classname
- # Global:
- # None
- # Arguments:
- # $1 = classname
- # $+ = paths where to look for JARs (recursively)
- # Returns:
- # Paths to JARs that contain the given class
- ###############################################################################
- find_jar() {
- if [[ $# -lt 2 ]]; then
- echo 'Usage: find_jar CLASSNAME PATH-1 [PATH-2 ... PATH-n]'
- return
- fi
- class=$1
- shift
- IFS=$(echo -en '\n\b')
- for file in $(find -L $@ -type f -iname '*.jar'); do
- if unzip -l "$file" | grep $class &>/dev/null; then
- echo "$file"
- fi
- done
- unset IFS
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement