Adding a zero to single digit variable

前端 未结 10 2081
星月不相逢
星月不相逢 2021-01-30 05:31

Trying to add a zero before the varaible if it\'s less than 10 and create said directory. I can\'t seem to get the zero to add correctly. Keeps resulting in making 02.1.20

10条回答
  •  一生所求
    2021-01-30 06:09

    $ seq --version | head -1
    seq (GNU coreutils) 8.21
    $ seq -f "%02g" 1 10
    01
    02
    03
    04
    05
    06
    07
    08
    09
    10
    

提交回复
热议问题