Posted in Code, Command Line, Linux Zero Padding In Linux Commands Binny V A July 2, 2008 Leave a Comment on Zero Padding In Linux Commands This is how you zero pad a numerical variable in bash. for ((x=1;x<=31;x+=1)); do echo `printf "%02d" $x`; done Original Article Author: Binny V AA philosopher programmer who specializes in backend development and stoicism.