#!/usr/bin/expect -f
#!/bin/bash
#auto ssh login
set host 192.168.7.224
set user "root"
set password "redhat"
#@spawn
spawn ssh $user@$host << cat /root/aa.sh

expect "*password:";
sleep 1;
send "$password\r\r";
interact;
~                                                                                        
~                                                                                        
~