Linux なら expect でコマンドを自動化しよう expect は対話的なプログラムとのやりとりを自動化するプログラムです。特定の文字列とマッチすると入力します。 対話プロンプトに自動入力できます。特定の文字列とマッチすると値を入力してくれます。 例) telnetでログインを自動化する 例) telnetでログインを自動化する #!/usr/bin/expect -- set timeout -1 spawn telnet hogehoge.com expect "login:" send "hoge\r" expect "Password:" send "hogepasswd\r" interact set timeout:expectのタイムアウト値はデフォルトで10秒になっているので10秒以上かかると思われる処理の場合 set timeout -1 でタイムアウトしな
![Linux なら expect でコマンドを自動化しよう | 温故知新 linux実践講座](https://cdn-ak-scissors.b.st-hatena.com/image/square/0943c91caae7497e3c859352b1dc47da5a515f93/height=288;version=1;width=512/http%3A%2F%2Farakanoj.com%2Fwp-content%2Fplugins%2Fwp-ogp%2Fdefault.jpg)