#! /bin/bash
# ask what the user would like to do
CMD=$CMD
MBA=$MB
RS=$RS
CT=$CT
echo
echo -n "What would you like to do??
REMEMBER WHEN PROGRAMMING ICP's TO SELECT CORRECT COMMAND ACCORDING TO
NECCESSARY TYPE CODE!
Please enter a command
ct = program ctek
ws = weather station
cc = config combiner
cr = config rec101
cm = ctek minicom
mr = metered unit
sc = Sub-Combiner
"
read -e CMD
if [ "$CMD" = "" ]; then
echo "ERROR: invalid command. Please try again."
./ask1.sh
fi
if [ "$CMD" = "ct" ]; then
./ctek_install_script
fi
if [ "$CMD" = "ws" ]; then
echo -n "What should the MBA be? "
read -e $MB
./config_weather echo $MB
fi
if [ $CMD = "cc" ]; then
echo -n "What would you like the MBA of this combiner to be? "
read -e $MB
./config_combiner echo $MB
fi
if [ $CMD = "cr" ]; then
echo -n "What would you like the MBA of this Sub-Combiner to be? "
read -e
./config_rec101 echo $MB
fi
if [ $CMD = "cm" ]; then
echo -n "Please press enter to start the minicom "
read -p "Press [Enter] to start the mincom"
./ctek_minicom
fi
if [ $CMD = "mr" ]; then
echo -n "What would you like the MBA of this metered unit to be? "
read -e $MB
echo -n "What is the ct size for this unit? "
read -e $CT
echo -n "Is this unit set to load? Please press Y or N. "
read -e $RS
if [ "$RS" = "N" ]; then
./sas echo $MB $CT
fi
if [ "$RS" = "Y" ]; then
./sas echo $MB $CT
else
./set_load echo $MB $CT
fi
fi
if [ $CMD = "sc" ]; then
echo -n "What would you like the MBA of this Sub-Combiner to be? "
read -e
./config_rec101 echo $MB
fi
if [ $CMD = "sas" ]; then
echo -n "What would you like the MBA to be? "
read -e $MB
./sas echo $MB
fi
SO, here is my situation. I have this script, and it is all just basic if/then stuff.
on lines 32-34, the if the if/then works like a charm and does exactly what I want. However on lines 55-69 when the script is run after the 3rd echo then read-e $RS, the script stops automatically, when there is more code to be run. I cannot figure it out. I also re-did the code later in the script to be a skeletal version with no echoes on lines 75-79, and it works there but not earlier in the script. I believe it is something to do with my echo/reads and somewhere along the line the info got jumbled but I cannot seem to locate the problem. any help would be great.
Thanks
UPDATE: all exec command were removed.