Friday, September 4, 2015

How to add a leading zero in Bash

If you want to add a leading zero to a number,

you can do as follows:

$ echo `printf '%02d' 8`
08
$

Reference:
http://stackoverflow.com/questions/55754/bash-script-to-pad-file-names

No comments:

Post a Comment