Help!

I need to total up values which are monetary

ie

VAR1=123.20 ( £123.20p)
VAR2=2000 ( £2000 )

can i do this using expr, i can total them up, but lose the .20p

Any help would be much appreciated

Is this all you're trying to do?

#! /bin/sh

var1=123
var2=2000

echo `expr $var1 + $var2`

exit 0

No. That he can already do, but that will lose the decimal places (i.e. expr is, essentially, int only).

Try

result=`echo "scale=2;${var1}+${var2}" | bc`
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.