NAVIGATION
Home
Gallery
Java
Linux
Web
Scripts And Utilities
Mobile And Sms
Misc
Contact
pixelWIKI
Nabaz Tag




<<

Useful Java Tools

Jar finder Linux Shell Script



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/sh

echo "Use current path? [y]"
read CURRENT

if [ "$CURRENT" == "" ] ; then CURRENT=y ; fi

if [ "$CURRENT" == "y" ] ; then
        SEARCHPATH=`pwd`
else
        echo "Path to search?"
        read SEARCHPATH
fi

echo "Class to find?"
read CLASS

echo "Recursive? [n]"
read RECUR

if [ "$RECUR" == "" ] ; then RECUR=n ; fi

if [ "$RECUR" == "y" ] ; then
        RECUR="-R"
else
        RECUR=""
fi

echo "Searching $SEARCHPATH for $CLASS"

#find "$SEARCHPATH" -name *.jar $RECUR -exec echo '{}'; -exec jar -tf '{}' ; | grep $CLASS

for i in `ls $SEARCHPATH/*.jar $RECUR` ; do
        if [ "`jar -tf "$i" | grep $CLASS`" != "" ] ; then
                echo "MATCH FOUND IN: $i"
        fi
done