私はそれに期待してbashスクリプトを書いています。
#!/bin/bash
IP1="a.b.c.d"
IP2="e.f.g.h"
HOST="xyz.com"
KEY="/path/to/key/file"
PORT="sshport"
/usr/bin/expect << EOD
    spawn ssh -p $PORT -i $KEY $HOST
    expect "*#"
    send "sh somescript\r"
    expect "Prompt from script:"
    send "$IP1\r"
    expect "Second Prompt from script"
    send "$IP2\r"
    interact
EOD
IP2 を送信した後にユーザーがスクリプトと対話できるように制御を取り戻すことを期待していますが、スクリプトは終了し、リモートホストからセッションからログアウトします。任意のポインタをお願いします?
ありがとうアミット