#!/usr/bin/expect set timeout 20 spawn ssh -l root 172.25.254.102 expect "(yes/no)?" send "yes " expect "password" send "Asimov " expect "#" send "hostname;exit " expect eof