Tuesday, 20 August 2013

Bash Script to Find a Symbol in a Substantial Amount of .jar Files

Bash Script to Find a Symbol in a Substantial Amount of .jar Files

In my mind, this should find the symbol I am looking for. Instead it does
not find the symbol. Where am I going wrong? I know the symbol exists in
one of the .jar files.
1 ARRAY=(`find ${PWD} -name '*.jar'`);
2 SYMBOL=$1;
3 for i in ${ARRAY[@]};
4 do
5 JAR=`jar -tf $i`;
6 GREPED=`echo ${JAR} | grep -s ${SYMBOL} | tr -d ' '`;
7 if [ "${GREPED}" != "" ]; then
8 echo $GREPED
9 fi
7 done
Perhaps I am misunderstanding the jar command options?

No comments:

Post a Comment