Increment time

I have to increment time ... by sec but i am getting the output like this.


 for m in {2..3}
> do
> for (( i = 1; i <= 13; i++ ))
> do
> echo "$m:$i"
>    done
> done
2:1
2:2
2:3
2:4
2:5
2:6
2:7
2:8
2:9
2:10
2:11
2:12

but i need output like this

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

Replace echo with this printf

printf "%02d:%02d" $m $i
1 Like

Use:

printf "%02d:%02d\n" "$m" "$i

Instead of:

echo "$m:$i"