System time comparison to fixed defined time

I have a requirement of checking the current system time and performing certain actions in a shell script. example:

if the current system time is greater than 1400 hrs, then perform step 1,2,3
if the current system time is greater than 1000 hrs, then perform step 1,2
if the current system time is greater than 0530 hrs, then perform step 1

is there any way for me to do this comparison in UNIX using variables/awk/perl? Kndly guide.

With awk you can do something like this:

awk -v t=$(date "+%H%M") '
BEGIN {
  if(t > 1400){
    ...
  }
  else if(t > 1000){
    ...
  }
  else if(t > 0530){
    ...
  }
}'

Regards

works like a charm :slight_smile:

Thanks Franklin52