#!/usr/bin/expect
set timeout 60
set username root
set password 88888888
set hostname syd
spawn ssh $username@$hostname
expect {
"yes/no"
{send "yes
"; exp_continue;}
"password:"
{send "$password
";}
}
expect -re "root@Sunyard" {send "touch test.txt
"}
expect -re "root@Sunyard" {send "exit
"}
exit