double echo in expect

来源:互联网 发布:淘宝网钓鱼背包 编辑:程序博客网 时间:2024/04/29 05:58

The problem is that the output stream coming from the spawned rlogin may show _MYPROMPT two times or it may show it three times.  The script has to handle either case.

Why does that happen?  Have ever logged in to a system and started typing a command before your .profile was done?  You will see what you typed, but your login ksh isn’t processing it yet.  When the login ksh finally gets done with the .profile, then you see your typed command *again* as ksh echoes it back to you.  I’ll call this the “double echo” problem.

For the automation script, I want the script to process the output stream through the PS1 prompt by the ksh.  If you hit the “double echo” problem, then the third expect is matching on the PS1 prompt.  If you missed the “double echo” problem, then the second expect already matched on the PS1 prompt, so the third expect is going to time out.



two echo 现象
时序准确,乱序扔到后面的内容,造成当机

原创粉丝点击