How do I iterate over a range of numbers defined by variables in Bash?

后端 未结 20 1881
予麋鹿
予麋鹿 2020-11-21 05:19

How do I iterate over a range of numbers in Bash when the range is given by a variable?

I know I can do this (called \"sequence expression\" in the Bash documentatio

20条回答
  •  被撕碎了的回忆
    2020-11-21 05:57

    If you're doing shell commands and you (like I) have a fetish for pipelining, this one is good:

    seq 1 $END | xargs -I {} echo {}

提交回复
热议问题