Comparing two timestamps

Hi all!!,

I'm using Ksh and working on Linux.

I want to compare two timestamps, timestamp1 and timestamp2.
Until, timestamp1 is lesser than timestamp2, i want to do something, lets say print something.

The code i have written is:

 
a=`date +%H:%M:%S`
b=`date +%H:%M:%S -d" 1 minute"`
echo $a
echo $b
while [ $a -le $b ];
do
echo "You have time"
a=`date +%H:%M:%S`
done

I tried executing this, but the output i get is :

 
03:55:57
03:56:57
date.sh: line 5: [: 03:55:57: integer expression expected

The problem is with the while loop condition.

Please help me on that.

Any help appreciated.
Thanks in advance!!

Remove the colons from the dates. They're not numeric, and you're doing a numeric comparison.

Alternatively:

  while [ ${a//:} -le ${b//:} ]; do
    ..
  fi

  ..