I have data that's held in one of three directories and I wanted to create a loop that would allow a user to easily access the data.
I'm trying to make this loop work so that if someone enters 1-3 it reads the number and changes the variable timePeriod to either "daily", "bars10s", or "bars100ms". When I echo the timeCheck and timePeriod variables when running the code to see if they're ok, the timeCheck always comes back right, but the timePeriod reads "daily" no matter what the timeCheck variable reads as. I'm pretty new to bash, so any help would be appreciated.
#!/bin/bash
echo
timePeriod=""
timeCheck=0
read -p "Time Period for fac to run(press 1 for daily, 2 for 10 sec
intervals, 3 for 100ms intervals): " -e -i "$timeCheck" timeCheck
if [ $TimeCheck==1 ] ; then
timePeriod="daily"
elif [ $TimeCheck==2 ] ; then
timePeriod="bars10s"
elif [ $TimeCheck==3 ] ; then
timePeriod="bars100ms"
else
echo "Not Valid Time Period. Please re-try."
fi
echo $timeCheck
echo $timePeriod