How to wait for a process to complete using tcl-expect

后端 未结 4 2114
小蘑菇
小蘑菇 2021-02-15 18:12

I am writing a script using expect in which I have to rlogin to some host & after that I need to send some commands. Now I want to exit to that host and relogin again to som

4条回答
  •  别那么骄傲
    2021-02-15 18:36

    Can you elaborate on "still script sending rest of the commands in between the previous process. "

    I tried this and it worked.

    spawn ssh host1
    expect ":"
    send pwd1
    expect "%"
    send "echo hi\r"
    expect "%"
    send "exit\r"
    expect eof
    spawn ssh host2    
    expect ":"
    send pwd2
    

提交回复
热议问题