#!/bin/bash
BSU_PACH=/home/weblogic/Oracle/Middleware/utils/bsu
WLSHOME_PACH=/home/weblogic/Oracle/Middleware/wlserver_10.3

# 将获取到的补丁jar包放入临时的文件,方便后续卸载
cd ${BSU_PACH} && ./bsu.sh -prod_dir=${WLSHOME_PACH} -status=applied -verbose -view | grep jar > tmp_jar

# 将查询到的tmp_jar文件通过tac逆序取出
jar_names=($(tac tmp_jar | awk ‘{print $NF}’ | awk -F ‘.’ ‘{print $(NF-1)}’))
for jar_name in ${jar_names[@]}; do
echo “remove ${jar_name}”
cd ${BSU_PACH} && ./bsu.sh -remove -patchlist=${jar_name} -prod_dir=${WLSHOME_PACH}
done