リモート サーバーにログインし、リモート サーバー上でコマンドを実行できる TCL プログラムを作成する必要があります。また、リモートサーバーから出力を取得する必要があります。
編集:
Kostixさん、返信ありがとうございます。私の要件は、TCL スクリプトがリモート サーバーにログインできる必要があることです。expect
メカニズムを介してパスワードを送信することを計画しており、その後、コマンドを送信することを計画しています。私のサンプルコードは次のようになります:
set prompt "(%|>|\#|\\\$) #"
spawn /usr/bin/ssh $username@$server
expect {
-re "Are you sure you want to continue connecting (yes/no)?" {
exp_send "yes\r"
exp_continue
#continue to match statements within this expect {}
}
-nocase "password: " {
exp_send "$password\r"
interact
}
}
これでログインできますが、このコードを拡張してコマンドを送信する方法がわかりません。いくつかの方法を試しましたが、うまくいきませんでした。