Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Script for telnet and run one command kill it and run another command using while loop

$
0
0
Code:

( sleep 3
 echo ${LOGIN}
 sleep 2
 echo ${PSWD}
 sleep 2
 while read line
 do
 echo "$line"
 PID=$?
  sleep 2
  kill -9 $PID
done < temp
 sleep 5
 echo "exit" ) | telnet ${HOST}

while is executing only command and exits.

Viewing all articles
Browse latest Browse all 16232

Trending Articles