How to run scripts within a telnet session?
I want to connect to a remote host using telnet
there is no username/password verification
then I need to input some commands for initialization
and then I need to repeat the following commands:
argument is read from a local file, in this file there are many lines, each line is a argument
and after runing one "cmd argument", the remote host will output some results
it may output a line with string "OK"
or output many lines, one of which is with string "ERROR"
and I need to do something according to the results.
basically, the script is like:
is it possible or not? thanks!
initialization_cmd #some initial comands
while read 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
echo $line >> bad_result_log
done < local_file
the good_result_log and bad_result_log are local files