This probably isn't the correct forum for this but these Forums have a lot of knowledge so I thought I would give this a shot.

I'm working on a bash script for a linux thin client where the script will check if the Thin Client is connected to the Virtual Machine. If it's not the script will reconnect to the VM. I know I can load up the script (like I've done so far) with the various IP addresses. What I'd like to do instead is list my variables of Hostname and their IP Address in a config file and then have my script check the hostname of the current computer, and find the hostname in the config file and use the IP Address. So far I've got it working where it reads the hostname and finds the IP to use based on the case statement without using a config file. This is what I have so far.


Code:
#!/bin/sh
# Check if rdesktop is running
LOGFILE=/home/rpitc/scripts/check.log
read var < ipfile
THISHOST=$(hostname)
if pgrep rdesktop > /dev/null
then
        echo "$(date "+%m%d%Y %T") : rdesktop is already running." >> $LOGFILE$
        exit 0
else
        echo "$(date "+%m%d%Y %T") : rdesktop has Stopped. Attempting to resta$
        case $THISHOST in
          (rpiA) rdesktop -z -u user -p password 10.100.100.10;;
          (rpiB) rdesktop -z -u user -p password 10.100.100.11;;
          (rpiC) rdesktop -z -u user -p password 10.100.100.12;;
        esac
        exit 0
fi

Right now my code is not using the line: read var < ipfile

So I would like list all my server IP's in the ipfile like this:


Code:
rpiA="10.100.100.10"
rpiB="10.100.100.11"
rpiC="10.100.100.12"

And then modify my code to reference the variables in ipfile in my script. I'm assuming I wouldn't use a case statement any longer, probably a for loop.

Any assistance you can give me on how best to accomplish this task would be greatly appreciated.

Thank you.