View Single Post
Posts: 145 | Thanked: 304 times | Joined on Jan 2010 @ Milton Keynes, UK
#1
Hi All,

I think i've found a little bug but would love for someone to confirm?

Basically I have this script
Code:
IN=00:08:19.12
IN=`echo $IN| cut -d'.' -f 1`

arr=$(echo $IN | tr ":" "\n")
a=0
for x in $arr
do
	echo $x
	a=$(( ( a * 60) + x ))
	echo $a
done
it should take IN and convert it into seconds.

This works on a unix box that I had access to but on the N900 I get the following error

Code:
Nokia-N900:/home/user/MyDocs# sh test
00
0
08
test: line 12: syntax error:  ( a * 60) + x
Could somebody recreate and confirm? or point out what I'm doing daft? =)

Thanks
jamie

UPDATE:

I've found that if I set IN to the following it works except for the lines in red italics? how wierd is that?

IN=00:00:19.12
IN=00:01:19.12
IN=00:02:19.12
IN=00:03:19.12
IN=00:04:19.12
IN=00:05:19.12
IN=00:06:19.12
IN=00:07:19.12
IN=00:08:19.12
IN=00:09:19.12

IN=00:10:19.12
IN=00:11:19.12
IN=00:12:19.12
IN=00:13:19.12
IN=00:14:19.12
IN=00:15:19.12
IN=00:16:19.12
IN=00:17:19.12
IN=00:18:19.12
IN=00:19:19.12
IN=00:20:19.12

Last edited by jamiefuller; 2012-04-27 at 15:08.