Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call function after spawn process

Status
Not open for further replies.

max1x

Programmer
Jan 12, 2005
366
US
Once spawn is completed for ssh, there could be several scenarios that can encountered. I'm trying to figure out how to handle most within a function and then move to the main part of the script i.e

Code:
spawn ssh -l us ser
#Do pattern match of what could be, possibly within a function somehow if possible and then move to the 2nd function which could be a set of commands.
expect "continue"
exp_send "yes\r"
expect "word"
exp_send "$crpP\r"
#Once successful then continue with some commands.  This could be second function.
expect "$prompt"
exp_send "$cmd1\r"
....
exp_send "logout\r"
 
Take a look at: //wiki.tcl.tk/11583

It seems to be lending itself to using re's that will grab the I/O buffer. You'll have to parse the accumulated information after that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top