__expect__() {
expect -c "spawn $1
set timeout 3600
expect {
-re \".*.*continue connecting (yes/no)?\" { send -- \"yes\r\" }
-re \".*password: \" { send -- \"$_pass\r\" }
timeout {
send_user \"timeout\n\"
stty echo
exp_continue
}
}
expect eof
wait \$spawn_id
close"
}
__expect__ "ssh $_user@$_host \"$COMMAND\""
没有评论:
发表评论