Ugly (but quick) script to get Oracle Fusion Middleware software versions

I created a quick script that I ran across all our environments to consolidate a list of all software versions. This includes versions of: operating system, WebLogic, Java, RDA, OPatch, and OPatch patches.

It's a crude script, but quite quick and efficient. It may have to be tweaked for non-Oracle SOA Suite products (you'll see below when grepping against registry.xml).

Here are the contents of getSoaSoftwareVersions.sh:

export DOMAIN_HOME=/u01/app/oracle/middleware
export JAVA_HOME=/u01/app/oracle/java

echo ""

echo "HOSTNAME:     `hostname`"
echo "LAST CHECKED: `date +%m/%d/%Y`"
echo "RED HAT:      `cat /etc/redhat-release | awk '{print $7}'`"

export MYVAR=`cat ${DOMAIN_HOME}/inventory/registry.xml | grep "SOA_QuickStart" | awk -F '"' '{print $6}'`
echo "WEBLOGIC:     `echo $MYVAR`"

export MYVAR=`${JAVA_HOME}/bin/java -version 2>&1 | head -n 1 | awk -F '"' '{print $2}'`
echo "JAVA:         `echo $MYVAR`"

export MYVAR=`cat ${DOMAIN_HOME}/oracle_common/rda/rda.sh | grep "Id" | grep "rda.sh" | head -1 | cut -d 'v' -f 2 | cut -d "R" -f 1`
echo "RDA:          `echo $MYVAR`"

export MYVAR=`${DOMAIN_HOME}/OPatch/opatch version | head -1 | awk '{print $3}'`
echo "OPATCH:       `echo $MYVAR`"

echo "PATCHES:"
${DOMAIN_HOME}/OPatch/opatch lsinventory | grep "Patch  " | awk '{print $2 " | " $8 "-" $7 "-" $11 " " $9 " " $10}'

echo ""

Here's the output:

HOSTNAME:     soatest
LAST CHECKED: 04/28/2020
RED HAT:      6.6
WEBLOGIC:     12.2.1.0.0
JAVA:         1.8.0_102
RDA:          1.20 2015/07/23 15:05:38
OPATCH:       13.3.0.0.0
PATCHES:
25527688 | 26-Apr-2020 10:24:18 EDT
24327938 | 26-Apr-2020 10:18:24 EDT
25388847 | 26-Apr-2020 10:16:12 EDT
25439226 | 03-Apr-2020 11:05:09 EDT
21830665 | 07-Mar-2018 13:49:53 EST
19154304 | 23-Feb-2018 14:45:45 EST