Search This Blog

Bash - print number with leading zeros


# 00001
echo $(printf '%05d' 1)


# 00123
n=123
echo $(printf '%05d' $n) 

No comments:

Post a Comment