How to use mod operator in bash?

后端 未结 4 758
悲哀的现实
悲哀的现实 2020-12-22 23:05

I\'m trying a line like this:

for i in {1..600}; do wget http://example.com/search/link $i % 5; done;

What I\'m trying to get as output is:

4条回答
  •  眼角桃花
    2020-12-23 00:03

    Try the following:

     for i in {1..600}; do echo wget http://example.com/search/link$(($i % 5)); done
    

    The $(( )) syntax does an arithmetic evaluation of the contents.

提交回复
热议问题