分页: 1 / 1
shell脚本for循环如何表达步长?
发表于 : 2010-04-06 13:55
由 罗非鱼
for循环,循环变量是i ,循环初始值1,终止值100,步长5
请问,如何写?
Re: shell脚本for循环如何表达步长?
发表于 : 2010-04-06 14:06
由 ibear
for i in $(seq 1 5 100)
Re: shell脚本for循环如何表达步长?
发表于 : 2010-04-20 16:06
由 jinsaiuser
for((i=1;i<=100;i+=5))
Re: shell脚本for循环如何表达步长?
发表于 : 2010-04-22 20:23
由 jcz37489
shell中的for循环是列举吧,可以用while写
Re: shell脚本for循环如何表达步长?
发表于 : 2010-04-25 17:49
由 hellounix
i=1
while [ "$i" -le 100 ]; do
...
i=$(($i+5))
done
Re: shell脚本for循环如何表达步长?
发表于 : 2010-04-25 20:46
由 eexpress
学3楼的吧。