foreach ip {
192.168.31.190
192.168.1.105
192.168.31.87
} {
puts "$ip"
set timeout 30
spawn ./scp2.sh 22 /Users/linzhiji/Documents/code/fxboxos/fxbox/* fxbox@$ip:/fxbox/
expect "password:"
send "123456!\r"
interact
if {$ip!="192.168.31.87"} {
spawn scp -P 22 /Users/linzhiji/Documents/code/fxboxos/h-config.sh \
/Users/linzhiji/Documents/code/a.conf \
/Users/linzhiji/Documents/code/b.sh \
/Users/linzhiji/Documents/code/c.sh \
fxbox@$ip:/fxbox/
expect "password:"
send "123456!\r"
interact }
}
另外expect脚本不支持? 路径后面加*,用了取巧办法,单独写了shell脚本,
#!/usr/bin/env bash
scp -P$1 -r $2 $3
|