#!/usr/bin/expect -f
set IP [lindex $argv 0 ]
spawn scp /root/.ssh/id_rsa.pub root@${IP}:/root/.ssh/
expect {
"Are you sure you want to continue connecting*" { send "yes\r"; exp_continue }
写了个脚本,大概是这样,但现在有个问题是,其中IP的值有脚本参数进行传递,例:./a.sh 127.0.0.1 现在像是参数可以无限多,让IP遍历所有传进来的参数,分别执行之后的语句,有大神知道怎么来写吗,求教???