分页: 1 / 1

问关于循环的脚本

发表于 : 2012-09-22 17:04
pisit
让用户输入需要脚本运行的次数然后按照用户需求执行若干次命令,这个脚本要怎么写
#!/bin/bash
read i
a=0
while [ $a -ne $i ]
do
xdotool mousemove 30 70 click 1
done

我用了这个后那滑鼠就一直在点,可能是a 没有跟着增加 就变成a 没有到所需要的数字,各位大大,麻烦帮忙看看,谢谢!

Re: 问关于循环的脚本

发表于 : 2012-09-22 17:17
枫叶饭团
加个a++啊

Re: 问关于循环的脚本

发表于 : 2012-09-22 17:27
cjxgm
[bash]
#!/bin/bash

read i
a=0

while [ $a -ne $i ]
do
xdotool mousemove 30 70 click 1
((a++))
done
[/bash]

Re: 问关于循环的脚本

发表于 : 2012-09-22 19:51
aerofox
[bash]
#!/bin/bash
read i
for ((a=0; a<i; a++)); do
do
xdotool mousemove 30 70 click 1
done
[/bash]

Re: 问关于循环的脚本

发表于 : 2012-10-03 16:46
pisit
:em11