#!/bin/bash set -u -e PATCHCODE="$1" for i in *.zip ; do NAME=${i/.zip} echo $NAME unzip $i pushd $NAME if ../$PATCHCODE ; then popd zip -9r $i $NAME else popd fi rm -rf $NAME done