telnetを使用してリモートホストに接続したいのですが、ユーザー名/パスワードの確認はありません。
telnet remotehost
次に、初期化のためにいくつかのコマンドを入力する必要があります
次に、次のコマンドを繰り返す必要があります。
cmd argument
引数はローカルファイルから読み取られます。このファイルには多くの行があり、各行は引数であり、1つの「cmd引数」を実行した後、リモートホストはいくつかの結果を出力し、文字列「OK」の行を出力するか、多くを出力します。行の1つは文字列「ERROR」であり、結果に応じて何かを行う必要があります。
基本的に、スクリプトは次のようになります。
initialization_cmd #some initial comands
while read line
do
cmd $line
#here the remote host will output results, how can I put the results into a variable?
# here I want to judge the results, like
if $results contain "OK";then
echo $line >>good_result_log
else
echo $line >> bad_result_log
fi
done < local_file
the good_result_log and bad_result_log are local files
それは可能かどうか?ありがとう!