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
you're forgetting to "hit enter". After sending exit, the way to wait for the process to end os expect eof:
expect eof
send "source xyz.csh\r" expect "%" send "exit\r" expect eof