Padding zeros in a string

前端 未结 7 615
情话喂你
情话喂你 2020-12-24 10:03

I\'m writing a bash script to get some podcasts. The problem is that some of the podcast numbers are one digits while others are two/three digits, therefore I need to pad t

7条回答
  •  滥情空心
    2020-12-24 10:54

    As mentioned by noselad, please command substitution, i.e. $(...), is preferable as it supercedes backtics, i.e. `...`.

    Much easier to work with when trying to nest several command substitutions instead of escaping, i.e. "backslashing", backtics.

提交回复
热议问题