Range with leading zero in bash

前端 未结 5 1549
慢半拍i
慢半拍i 2020-12-31 03:06

How to add leading zero to bash range?
For example, I need cycle 01,02,03,..,29,30
How can I implement this using bash?

5条回答
  •  余生分开走
    2020-12-31 03:39

    A "pure bash" way would be something like this:

    echo {0..2}{0..9}
    

    This will give you the following:

    00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
    

    Removing the first 00 and adding the last 30 is not too hard!

提交回复
热议问题