如何在bash中使用mod运算符?

前端之家收集整理的这篇文章主要介绍了如何在bash中使用mod运算符?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试着这样一行:
for i in {1..600}; do wget http://mydomain.com/search/link $i % 5; done;

我想得到的输出是:

wget http://mydomain.com/search/link0
wget http://mydomain.com/search/link1
wget http://mydomain.com/search/link2
wget http://mydomain.com/search/link3
wget http://mydomain.com/search/link4
wget http://mydomain.com/search/link0

但我实际得到的只是:

wget http://mydomain.com/search/link
尝试以下操作:
for i in {1..600}; do echo wget http://mydomain.com/search/link$(($i % 5)); done

$(())语法做一个arithmetic evaluation内容

原文链接:https://www.f2er.com/bash/392335.html

猜你在找的Bash相关文章