How can I increment a number in a while-loop while preserving leading zeroes (BASH < V4)

后端 未结 3 2203
旧时难觅i
旧时难觅i 2020-12-19 22:56

I am trying to write a BASH script that downloads some transcripts of a podcast with cURL. All transcript files have a name that only differs by three digits: filename

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-19 23:53

    Will this do?

    #!/bin/bash
    
    i=1
    zi=000000000$i
    s=${zi:(-3)}
    echo $s
    

提交回复
热议问题