shell - How to wait for a process to complete using tcl-expect -
i writing script using expect in have rlogin host & after need send commands. want exit host , relogin again other host , send commands. run of script not waiting first host complete jobs , exit instead sends other commands in between previous process. how can achieve using expect please guide?
sample code follow :
#!/usr/local/bin/expect -f spawn rlogin host1 expect "%" send "source xyz.csh\r" send "exit\r" expect "%" spawn rlogin host2 set of commands
can elaborate on "still script sending rest of commands in between previous process. "
i tried , worked.
spawn ssh host1 expect ":" send pwd1 expect "%" send "echo hi\r" expect "%" send "exit\r" expect eof spawn ssh host2 expect ":" send pwd2
Comments
Post a Comment