I am trying to test a date ...if it's between those 2 time frames i want to print them... But i get errors..This is my script
today_time=$(date +%H:%M:%S --date '-1 sec')
today_dow=$(date +"%u")
today_less=$(date +%H:%M:%S --date '-1 min')
today_more=$(date +%H:%M:%S --date '+1 min')
echo $today_less
echo $today_time
echo $today_more
if [ $today_less -gt $today_time ] && [ $today_time -lt $today_more ]; then
echo "$today_less"
echo "$today_time"
echo "$today_more"
else
echo no
fi
I have tried -ge with -le and gives me: Integer expression expected -gt and -lt: Integer expression expected I also used '<' and '>' and gives me: No such file or directory.
I need to make this work with time dates only...not with int
Cause the time i will extract it from the db and replace today_time with the time from db.