- 论坛徽章:
- 0
|
本帖最后由 situxiaoquan1 于 2011-05-19 18:33 编辑
我的脚本如下:
#!/usr/bin/expect -f
for {set IP 11} {$IP<=14} {incr i 3}
{
spawn ssh $IP
expect "login*"
send "db2inst1\r"
expect "Password:"
send "db2inst1\r"
expect "*>*"
send "cd /home/db2inst1/weihu/activemobile/sorting\r"
expect "*>*"
send "rm 1.txt\r"
expect "*>*"
send "exit\n"
expect eof
}
目前只是登陆一台主机可以实现了,想循环登陆多台执行相同命令怎么做?
执行脚本报错:
wrong # args: should be "for start test next command"
while executing
"for {set IP 11} {$IP<=14} {incr i 3}"
(file "./test.sh" line 3)
expect循环应该怎么写呢? |
|