0
我試圖獲取所有「RESP:0,成功;」輸入命令:RESP:0,成功; - 這裏是我的代碼,我會拿它嗎?獲取shell腳本中的行
**for i in {2..4}
do
date
CMDCount="CMD"$i
eval CMD="$"$CMDCount
echo "server CMD "${CMD}""${CMDCount}"";
echo ""
(sleep 1;echo $login;
sleep 1;echo ${CMD};
sleep 1;echo $logout;sleep 1)|telnet localhost 9685
sleep 1
done**
輸出是這樣的:
server CMD xxxxxxxxxxxxxxxxxxxxxxxxxxxxCMD2
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
CONNECTING TO xxx...
PROCESS CPL CONNECTED...
Enter command:RESP:0,sucess;
Enter command:
Enter command:
Enter command:Connection closed by foreign host.
Sat Aug 3 12:18:21 CST 2013
server CMD xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxCMD3
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
CONNECTING TO xxx...
PROCESS CPL CONNECTED...
Enter command:RESP:0,sucess;
Enter command:
Enter command:
Enter command:Connection closed by foreign host.
Sat Aug 3 12:18:26 CST 2013
server CMD xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;CMD4
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
CONNECTING TO xxx...
PROCESS CPL CONNECTED...
Enter command:RESP:0,sucess;
Enter command:
Enter command:
Enter command:Connection closed by foreign host.