problem in arithmetic operations

hello all,
i am having a variable with a value of 0000010000 and if i add the variable with some no:

suppose
i=0000010000
n=`expr $i + 1`
echo $n

the output i am reciving is 10001 .it deletes all the zeros
but i need result as 0000010001..
please help me...

thanks in advance...... :wink:

Sea this thread: Addition with the prefixing zeros included

typeset -z10 n

Or without external commands (like expr):

ksh

i=0000010000;n=$(printf "%010d" $((i+1)))

bash

i=10#0000010000;n=$(printf "%010d" $((i+1)))

With newer versions of bash:

i=10#0000010000;n=$(printf "%010d" $((++i)))