How Do I use Values from another file in shell?

Right now I am trying to right a script that will check the values from a .properties file against a group of set values in a script

But for some reason when I call the values they wont match up right, this is what I have so far, I believe maybe the .properties values are being stored right

#!/bin/bash 
SuccessfulDiffRun="true" 
timestamp() { date +"%a %d %b %Y"; }
TodaysDate=$(timestamp)
echo ""
echo $TodaysDate
echo ""
#Properties Call
file="savedState.properties" 
#Echo out the file
while read LINE; do echo "$LINE"; done < savedState.properties

#Check Values Hotpatch.
echo ""
echo "Running Checks HotPatch..."
if [ "$TodaysDate" = "$WD_MANAGEGOLD_DATETIMESTAMP" ]; then
    echo Dates Are A Match
    if [ "$SuccessfulDiffRun" = "$WD_MANAGEGOLD_SUCCESS" ]; then
        echo Diff Run Successful
        echo Hotpatch Run Was Successful
    else
        echo Diff Run Not Successful
        exit 0
    fi
else
    echo Dates Not A Match
    exit 0 
fi

#Check Values RC.
echo ""
echo "Running Checks RC..."
if [ "$TodaysDate" = "$WD_MANAGERC_DATETIMESTAMP" ]; then
    echo Dates Are A Match
    if [ "$SuccessfulDiffRun" = "$WD_MANAGERC_SUCCESS" ]; then
        echo Diff Run Successful
        echo RC Run Was Successful
    else
        echo Diff Run Not Successful
        exit 0
    fi
else
    echo Dates Not A Match
    exit 0 
fi

and the values in the .properties file

WD_MANAGEGOLD_DATETIMESTAMP=Wed 21 May 2015 
WD_MANAGEGOLD_SUCCESS=false
WD_MANAGERC_DATETIMESTAMP=Wed 21 May 2015 
WD_MANAGERC_SUCCESS=false

any help would be great


Source: shell

Leave a Reply