Linux expect 使用简介
一.登陆到远程主机
脚本代码如下:
############################################## #!/usr/bin/expect set timeout 30 spawn ssh -l username hostip expect { "yes/no" { send "yes\r";exp_continue } "password:" { send "hostpassword\r" } } interact ##############################################