Difference between revisions of "bash single to double digit conversion"

From thelinuxwiki
Jump to: navigation, search
(Created page with "method using printf... for i in {1..12}; do i=`printf "%02d" $i` echo $i done output 01 02 03 04 05 06 07 08 09 10 11 12 category:scripting [[cat...")
 

Latest revision as of 23:39, 10 May 2013

method using printf...

for i in {1..12}; 
do
  i=`printf "%02d" $i`
  echo $i
done

output

01
02
03
04
05
06
07
08
09
10
11
12