for m in "GATEWAY" "ORDER" "PAY"
do
cd /home/cpay/tomcat${m}/ROOT/WEB-INF/lib
rm -rf ./autojar*
i=0
for file in `ls -1 | grep "^com."` #还可以使用 find ./ -name "com.*.jar"
do
filelist[$i]=$file
((i++))
done
#复制并解压
j=0
for filename in ${filelist[*]}
do
cd /home/cpay/tomcat${m}/ROOT/WEB-INF/lib
mkdir autojar${j}
cp ./$filename autojar${j}
cd /home/cpay/tomcat${m}/ROOT/WEB-INF/lib/autojar${j}
jar -xvf ./*
((j++))
done
done