|
Reading Hours and Minutes from file and comparing with current
Hi,
Time till when the application should run is indicated in a file. First line is hour and second line is minute.
file:
10
55
Means my application should run till 10:55.
Now in a shell script, i am trying to make that logic but with no luck.
min=`tail -n 1 /file_with_time`
hour=`head -n 1 /file_with_time`
chour=`date +%H`
cmin=`date +%M`
if [ $chour < $hour ] <== Shell script throws error here when value is two digits ie if first line the file is > 9.
then
run_my_app
fi
if [ $chour = $hour ]
then if [ $cmin < $min ]
then
run_my_app
fi
fi
Kindly suggest.
SDG
|