12 October 2010

Shell: a script file to search a directory of Jars about which jar cointains which file?

Hi folks,

Today I am coming with some shell script that is useful if you want to need to know from a group of Jars in certain directory which one of them contains a certain file (Java class)

#! /bin/sh

path=$1
segment=$2

if [ -z "$path" ] || [ -z "$segment" ]
then
echo "Usage: $0 <path> <segment>"
exit
fi

for jar in $path/*.jar ; do echo " *** $jar *** " ; jar tf $jar| grep --color=always $segment; done;

1 comment:

Anonymous said...

the most important thing that's i didn't understand a word :D

but that's important too

hhhhhhhhhhhhhh

XMasterrrr.