#!/bin/bash
for file in *.zip
do
dir_optach=`ls -lrt $file| awk '{print $9}'|awk -F _ '{print $1}' |sed 's/p*//g'`
num=`ls -lrt|egrep $dir_optach|wc -l`
if [ $num -eq 1 ];
then
unzip -o -q $file
echo $file":unzip finished" >> optach.log
cd $dir_optach
$ORACLE_HOME/OPatch/opatch apply
echo $dir_optach" patch fininshed" >> optach.log
cd ..
fi
donebash