#!/usr/bin/expect -fset ipaddr "192.168.5.4"set passwd "123qwe"set timeout 30
spawn ssh root@$ipaddrexpect {"yes/no" { send "yes "; exp_continue }"password: " { send "$passwd " }}expect "*# "send "ls "send "exit "expect eofexit