以下の内容はhttps://iww.hateblo.jp/entry/20121214/expectより取得しました。


expectのキーワード

expectで特別な意味を持つキーワードは timeout, eof, default (defaultはtimeoutとeof両方)

while { true } {
    send_user "START\n"
    spawn ssh example.com do_command
    expect {
        "assword:"  { send "$PASSWORD\r"; wait }
        timeout { close; wait }
        eof { wait }
    }
    send_user "END\n"
    sleep 5
}

タイムアウトのときは まだプログラムが生きているから、waitするまえにcloseを呼ぶ必要がある
eofのときはすでにクローズされているのでcloseを呼んではいけない
close済みなのにcloseしたり、wait済みなのにcloseやwaitを呼ぶとエラーになってスクリプトの実行が中断されてしまう やりづらい仕様




以上の内容はhttps://iww.hateblo.jp/entry/20121214/expectより取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14