On 05/04/2014 03:42 PM, Asif Iqbal wrote: > On Sun, May 4, 2014 at 4:32 PM, ~Stack~ wrote: [snip] > > verifiednum=`printf %02d $uservar` > > This works really well when they enter only a single digit or 01-07. > However, on 08 or 09, this fails. > [snip] > 1) Does anyone know what is wrong here? > > leading zero is interpreted as octal. You need to prepend the number > with 10# to convert it to decimal first
That makes sense. But why does it only fail on 08 and 09? Shouldn't it also fail on 01-06? > > 2) Is there a better way of solving this issue? > > so try this instead printf %02d $(( 10#08 )) Yup! That worked! Thank you very much! ~Stack~
signature.asc
Description: OpenPGP digital signature