#!/usr/bin/expect -f
set user root
set host 192.168.2.186
set password 123456
set timeout -1
spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
expect "#"
send "ls \r"
interact
set user root
set host 192.168.2.186
set password 123456
set timeout -1
spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
expect "#"
send "ls \r"
interact