Deciphering strings or variable values

Hi,

I have a script at the moment of which reads in simply what the latest version is within a folder i.e. v001, v002, v003 etc and then stores this latest version in a variable i.e. $LATEST would echo v003. I have then cut this string so that I only consider the 003 part. I would then like to increment this to 004 and then put the v back in front of it again i.e. v004. What is the easiest way of doing this?

Cheers

CF

Example:

valor=0003
aux=`printf %.4d $(expr $valor + 1)`
echo "[$aux]"

i supose you want 4 digits for this motiv is .4d

Great it worked and how do you then append a letter in front of it so valor = v00004?

change this line

aux=`printf v%.4d $(expr $valor + 1)`