user=root
ip=1.1.1.1
passwd=1111
expect<<!
spawn ssh $user@$ip
expect {
"(yes/no)?" {
send "yes
"
expect "assword:"
send "$passwd
"
}
"assword:" {
send "$passwd
"
}
}
expect "#"
send "sh /root/sbin/get_master.sh
"
send "exit
"
expect eof
!