Expr strange problem to me

Hi all,

Please help me solve below issue.

expr 04170000000 + 1 gives me -124967295 and offcourse I want this to be 04170000001

and it happens for some sort of number like some other
02300000000
02600000000
03800000000
I guess after exceeding certain range it is converting it somewhere somehow format dont know.

IIf you have any Idea that would be great. or any alternative way of acheiving it using awk etc do pass it.

Thanks,
Revansing.

hmmm - I don't see this:

#  expr 04170000000 + 1
4170000001

What OS are you using ?

anyway you could try:

#  echo "04170000000 + 1" | bc
4170000001

or
#  echo 04170000000 1 | awk '{print $1 + $2}'
4170000001

depending on your input format.

HTH

Thanks for your valuable reply.
yes I can see correct with this
echo "04170000000 + 1" | bc
and
echo 04170000000 1 | awk '{print $1 + $2}'
but you know I have a loop for say 100 time and which will sum up the column values.

like this :
while (i<=10)
do
sum=$sum+$temp
done
echo "final sum $sum"

Please have your thougts how to achieve this instead of expr as it still gives me incorrect result.

Thanks,
Revansing