//---------------------------- file searchJars
#!/bin/bash
CACHE=~/bin/listOfJars_
if [ ! -f $CACHE ]
then
cacheJars $CACHE
fi
for file in $(cat $CACHE) ; do
found=$(jar tf $file | grep $1)
if [ "$found = "" ]
then
continue
fi
echo ============= FOUND ============
echo $file
echo $found
done
//---------------------------- file searchJars end
//---------------------------- file cacheJars
#!/bin/bash
CACHE=~/bin/listOfJars_
if [ "$1" != "" ]
then
CACHE=$1
fi
find ~ -name *.jar > $CACHE
//---------------------------- file cacheJars end
The scripts are just bare bones, not foolproof, they don't suggest help or prevent incorrect usage. You can add this stuff yourself.
This is what you do: create folder bin in your home directory, create files searchJars and cacheJars with above content there. Don't forget to make them executable with
chmod +x <filename>
Then run
~/bin/searchJars SomeMethod
First time the execution will be slower because of caching all jars' into the list. Next time the step will bi omitted. To refresh the cache run
~/bin/cacheJars
without parameters.
No comments:
Post a Comment