linux - Adding two numbers with zero padding in bash shell -


var1=00001 var2=00001 expr $var1 + $var2 

expected result: 00002

actual result: 2

how can expected result in bash?

you can this:

printf "%05d\n" $(expr $var1 + $var2) 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -