troubleshooting Question

How do I pass arguments to autoexpect script

Avatar of Cherylvan
Cherylvan asked on
System Programming
3 Comments1 Solution1198 ViewsLast Modified:
I have the following autoexpect script:
set timeout -1                                                            
spawn telnet 86.216.72.205                                                
match_max 100000                                                          
expect -exact "Trying...\r                                                
Connected to 86.216.72.205.\r                                              
Escape character is '^\]'.\r                                              
Local flow control off\r                                                  
\r                                                                        
Please select a destination:\r                                            
1. Power Plant administration, need Galaxy controller password.\r          
2. Network Administration, requires network administration password.\r    
"                                                                         
send -- "1\r"                                                              
expect -exact "1\r                                                        
\r                                                                        
TECLEE CLAVE:\r                                                            
ENTER PASSWORD: "                                                         
send -- "super-user\r"                                                    
expect -exact "\r                                                          
\r                                                                        
** "                                                                       
send -- "ampeers\r"                                                        
expect -exact ".\r                                                        
** "             
send -- "bye\r"  
expect eof        

I want to be able to pass it an ip address using an argument instead of having it hard coded in.  Expect is something I am totally ignorant about.  I have a file that will determine which IP address I will pass it.  Please help!!!
ASKER CERTIFIED SOLUTION
yuzh

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros