Zero padded integer in BASH

Let say we are trying to print
01

We can do that, using the following command
i=1
a=`printf "%0*d\n" 2 $i`

If we echo the ${a} variable, we will see the desired formatted integer i.e.
01

Comments

Popular posts from this blog

VMD High Resolution Image and Movie

Inset Plot in GRACE (Xmgrace)