ºìÁªLinuxÃÅ»§
Linux°ïÖú

shellÈçºÎ×Ô¶¯µÇ¼

·¢²¼Ê±¼ä:2009-08-31 17:55:30À´Ô´:ºìÁª×÷Õß:kyouhou
ÎÒÏëʵÏÖÒÔϹ¦ÄÜ£º
-------------------
1, telnet IP1
2, telnet IP2
3,½ÓÊÜctrl+cÖ¸Áî,½øÈëÃüÁîÐÐģʽ,
------------------
ÏÖÔÚÔÚʵÏÖµÚÈý²½Ê±ÎÞ·¨ÊµÏÖ.kill -2 $$, kill -2 $!, trap " output mesg" SIGINTµÈ¶¼ÎÞ·¨ÊµÏÖ¡£
¸÷λ˭ÄÜʵÏÖ°¢£¬expectºÃÏñ¿ÉÒÔ£¬µ«»¹Ã»³¢ÊÔ¡£

лл¸÷λ´óÏÀÁË¡£
×¢£º×Ô¶¯µÇ¼µÄʵÏÖ
{
sleep 3; echo "user"
sleep 3;echo "pas"
sleep 3; echo "telnet IP2"
sleep 3; echo "user"
sleep 3;echo "pas"
} | telnet IP1
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. Luoall ÓÚ 2009-08-31 20:23:58·¢±í:

    ²»¶®£¬¶¥ÉÏ