-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfindJarForClass
More file actions
executable file
·37 lines (33 loc) · 957 Bytes
/
findJarForClass
File metadata and controls
executable file
·37 lines (33 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#
# Search (via regex) for specific files (classes) within the Jars located at
# pwd and below. If you pass a package name, the package separators (.) will
# be convreted slashes (/).
#
# Such as the two equivalent searches:
#
# $ findJarForClass com.ibm.icu.text.NumberFormat
# $ findJarForClass "com/ibm/icu/text/NumberFormat"
#
if [ "$#" != "1" ]; then
echo "You must provide ONE argument (the search string)"
exit -1
fi
# Convert "." (package separator) to "/" (path separator)
SKIP_BIN=true
toFind=$(echo $1 | tr "." "/")
echo "Searching jar files for ${toFind}"
echo ""
for jar in `find . -name "*.jar"`; do
if [[ "${SKIP_BIN}" == "true" ]]; then
if [[ "$jar" == *"/bin/"* ]]; then
# echo "Skipping $jar as it is in a bin folder"
continue
fi
fi
found=`unzip -t $jar | grep -e "$toFind"`
if [ "" != "${found}" ]; then
echo $jar
echo $found
fi
done