私はsshを5ボックスに入れ、aptitude dist-upgrade -dを実行し、パッケージを圧縮して元のボックスに戻します。長いスクリプトを使わずに、繰り返しのためのexpectを使用するにはどうすればよいですか?
すべてのボックスは同じパスワードを持ち、dist-upgradeにyesと言うにはすべてのボックスに「y」という入力が必要です。
私の現在の期待スクリプトは私の質問は、それがパスワードを送信するためのパスワードを聞かれる場合ようにI「重複排除」これを行う方法、である次
## Original box
expect "password"
send "Password\n"
## Box sshing to
expect "password"
send "Password\n"
expect "want to continue?"
send "y\n"
の繰り返しの負荷で長いと厄介ですcontinueプロンプトが表示されたら、yを送信します。私は(時々キーチェックが、私は「はい」を送信する必要がミックスにスローされた)とき来るかの完璧な順序を取得する必要がないように
全スクリプト以下:
#!/usr/bin/expect -f
set timeout -1
## This uses manualpatching.sh, used to zip up a list of the latest Debian packages
spawn ./manualpatching.sh
## BOX1
expect "password"
send "Password\n"
expect "want to continue?"
send "y\n"
## BOX2
expect "password"
send "Password\n"
expect "password"
send "Password\n"
expect "want to continue?"
send "y\n"
expect "password"
send "Password\n"
expect "connecting"
send "yes\n"
## BOX3
expect "password"
send "Password\n"
expect "password"
send "Password\n"
expect "want to continue?"
send "y\n"
expect "password"
send "Password\n"
## BOX4
expect "password"
send "Password\n"
expect "password"
send "Password\n"
expect "want to continue?"
send "y\n"
expect "password"
send "Password\n"
## BOX5
expect "password"
send "Password\n"
expect "password"
send "Password\n"
expect "want to continue?"
send "y\n"
expect "password"
send "Password\n"
## BOX6
expect "password"
send "Password\n"
expect "password"
send "Password\n"
expect "want to continue?"
send "y\n"
expect "password"
send "Password\n"
## END
expect eof
あなたのスクリプトを表示してください! – Gaurav
さて、今投稿を編集します –
ありがとうございました。ありがとうございました –