Archive for the ‘Shell’ tag
Localizar uma classe dentro de um arquivo .jar
echo usage="Uso: findJavaClass directory ClassName "
if [ $# -lt 2 ] ; then
echo $usage
exit 1
fi
if [ -d 1 ] ; then
FIND_CMD="find 1"
else
echo "Diretorio nao existe"
exit 1
fi
$FIND_CMD -name \*.jar | while read jar_file ;
do
found_class=`unzip -l $jar_file | awk '{print }' | grep `
num_classes=`echo $found_class | wc -c`
if [ $num_classes -gt 1 ] ; then
echo ""
echo "Arquivo:"
echo " $jar_file"
echo "Classes:"
echo $found_class | sed 's/\ /\n/g' | sed 's/^.*/\ \ \ \ &/g'
fi
done
Descaradamente copiado do blog do Claudio