#!/bin/sh
set timeout 30
spawn ssh <username>@<server_ip>
expect {
"*yes/no*" { send "yes\r"; exp_continue}
"*Password:*" {send "password\r"}
}
expect "*#*"
send "pss\r"
interact
set timeout 30
spawn ssh <username>@<server_ip>
expect {
"*yes/no*" { send "yes\r"; exp_continue}
"*Password:*" {send "password\r"}
}
expect "*#*"
send "pss\r"
interact