#!/usr/bin/expect
set timeout 30
spawn ssh 192.168.2.125
expect {
        "yes/no" { send "yes\r";exp_continue }
        "password:" { send "redhat\r" }
}
expect "]#"
send "df -h > /tmp/diskfile\r"
interact