There was this thread earlier with the same name and the solution provided was excellent. Here is the solution to find diffrenc between two timestamp
$ cat timestamp
#! /usr/bin/ksh
echo enter first time stamp
read TIME1
echo enter second time stamp
read TIME2
H1=${TIME1%:+([0-9])}
M1=${TIME1#+([0-9]):}
H2=${TIME2%:+([0-9])}
M2=${TIME2#+([0-9]):}
H1=${H1#0}
M1=${M1#0}
H2=${H2#0}
M2=${M2#0}
((MAM1=H1*60+M1))
((MAM2=H2*60+M2))
((MAM1>MAM2)) && ((MAM2=MAM2+1440))
((diff=MAM2-MAM1))
echo diff = $diff
my problem is, i have excecuted the same code in in AIX box and it works well, but while running this code in solaris i get the following error
$ ./Timestamp.sh
Start time: 00:13:01
End Time : 06:13:26
./Timestamp.sh: syntax error at line 18: `H1=${TIME1%:+' unexpected
Since the logic used here is excellent, but the problem is due to the Solaris,Any help will be much appreciated on how the H1=${TIME1%:+([0-9])} statement can be changed to run on solaris.
Thanks in advance